Open utterances-bot opened 2 years ago
This project is aimed at helping you better understand how the type system works, writing your own utilities, or just having fun with the challenges.
https://ghaiklor.github.io/type-challenges-solutions/ru/medium-flatten.html
type Flatten<T extends any[], A extends any[] = []> = T extends [infer H, ...infer L] ? Flatten<L, H extends any[] ? [...A, ...Flatten<H>] : [...A, H]> : A;
Flatten
This project is aimed at helping you better understand how the type system works, writing your own utilities, or just having fun with the challenges.
https://ghaiklor.github.io/type-challenges-solutions/ru/medium-flatten.html