Skip to content

Instantly share code, notes, and snippets.

@protoEvangelion
Created May 27, 2022 16:59
Show Gist options
  • Save protoEvangelion/4bfbca1cccbf1f7075439ee6de0e27f6 to your computer and use it in GitHub Desktop.
Save protoEvangelion/4bfbca1cccbf1f7075439ee6de0e27f6 to your computer and use it in GitHub Desktop.
export type ExpandRecursively<T> = T extends (...args: infer A) => infer R
? (...args: ExpandRecursively<A>) => ExpandRecursively<R>
: T extends object
? T extends infer O
? { [K in keyof O]: ExpandRecursively<O[K]> }
: never
: Texport type ExpandRecursively<T> = T extends (...args: infer A) => infer R
? (...args: ExpandRecursively<A>) => ExpandRecursively<R>
: T extends object
? T extends infer O
? { [K in keyof O]: ExpandRecursively<O[K]> }
: never
: T
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment