Skip to content

Instantly share code, notes, and snippets.

@roalcantara
Last active September 6, 2020 09:06
Show Gist options
  • Select an option

  • Save roalcantara/b1cf2cee376152cc5b95517e49d8bc69 to your computer and use it in GitHub Desktop.

Select an option

Save roalcantara/b1cf2cee376152cc5b95517e49d8bc69 to your computer and use it in GitHub Desktop.
TypeScript 3.9 | Advanced Types: Extracts a tuple of param types of a given function
type Params<F extends (...args: any[]) => any> = F extends (
...args: infer A
) => any
? A
: never
const fn00 = (name: string, age: number, single: boolean) => true
type Type1 = Params<typeof fn00> // [name: string, age: number, single: boolean]
// https://medium.com/free-code-camp/typescript-curry-ramda-types-f747e99744ab
// https://github.com/millsp/medium/blob/master/types-curry-ramda/src/index.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment