U['length'] extends T ? U : NRange<T, [...U, 0]>
type Flatten<T, U extends any[] = []> = T extends []
? U
: T extends [infer F, ...infer R]
? Flatten<R, [...U, ...Flatten<F>]>
: [...U, T]
type TupleSum<T extends number[]> = Flatten<{ [K in keyof T]: NRange<T[K]> }>['length']
type A = TupleSum<[1, 2, 3]>
Это древнегреческий?
Обсуждают сегодня