Simple Flatten Type
This file contains 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
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