mg901
mg901
@soeasyjx It's an obvious and expressive solution. > ```ts > type CompareArrayLength = T[U['length']] extends undefined? T['length'] extends U['length']?0:-1:1 > ```
@teamchong thank you, bro. It's a really valuable remark.
Slightly tweaked. ```typescript type Flatten = T extends [infer Head, ...infer Tail] ? Head extends unknown[] ? [...Flatten, ...Flatten] : [Head, ...Flatten] : T; type KeyType = string | number;...
### Works with additional tests But not as perfect as the @heyuelan's [solution](https://github.com/type-challenges/type-challenges/issues/34727). ```typescript type Includes = T extends [ infer Head, ...infer Tail, ] ? Equal extends true ?...
@2083335157 thnx, bro. But your solution didn't pass the last two tests.
**Works with big numbers**. ```typescript type SplitString = S extends `${infer D}${infer Rest}` ? [D, ...SplitString] : []; // prettier-ignore type DigitGreaterThan = A extends '0' ? (B extends '0'...