This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. args-order matters: | |
import { map } from 'ramda' | |
type Person { | |
name: string | |
} | |
function getName(person: Person) { return person.name } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* variation on https://medium.com/@DanHomola/react-higher-order-components-in-typescript-made-simple-6f9b55691af1 */ | |
import * as React from 'react' | |
import { wrapDisplayName } from 'recompose' | |
// Props you want the resulting component to take (besides the props of the wrapped component) | |
interface ExternalProps {} | |
// Props the HOC adds to the wrapped component | |
export interface InjectedProps {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// use cases: class decorators, etc | |
function forceOnlyOnce (test: string & {__T?: undefined}) { | |
const test2: string = test | |
return test2 as string & { __T: null } | |
} | |
const a = forceOnlyOnce('123') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usage: youtube-dl-playlist <youtube-playlist-url> | |
function youtube-dl-playlist() { | |
youtube-dl -o "%(playlist_index)s-%(title)s.%(ext)s" $1 | |
} |
NewerOlder