Last active
August 6, 2018 16:00
-
-
Save babakness/0031c9457737f20559e4894a52ea9869 to your computer and use it in GitHub Desktop.
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