Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Simple Flatten Type
type Flatten<T> = T extends any[] ? T[number] : T;
// If you want to flatten no lower than one level
type FlattenArray<T> = T extends any[][] ? T[number] : T;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment