zhugezhen
zhugezhen
//求指点感觉不是很对 ```ts type Curry< F extends (...args: any[]) => any, P extends any[] = Parameters, R = ReturnType > = P extends [infer A, ...infer B] ? B extends []...
```ts type Shift = T extends [infer A, ...infer B] ? B : []; // 测试用例 type S0 = Shift; // [2,3] type S1 = Shift; //[number, boolean] type S2...
```ts type Foo = { a: number; b?: string; c: boolean; }; // 交叉 、 `-?`去可选 type SetRequired = { [K in keyof T as Extract]-?: T[K]; } & {...
```ts //利用11题编写的isEqual type Includes = T extends [infer A, ...infer B] ? IsEqual extends true ? true : Includes : false; type I0 = Includes; // false type I1 =...
```ts type Tail = T extends [infer A, ...infer B] ? B : []; // 测试用例 type T0 = Tail; // [] type T1 = Tail; // [2] type T2...
直接使用第九题的JoinStrArray操作Repeat后的元组 ```ts type RepeatString = JoinStrArray< Repeat, "" >; type S02 = RepeatString; // '' type S12 = RepeatString; // 'aa' type S22 = RepeatString; // 'ababab' ```
```ts type Unshift = [E, ...T]; // 测试用例 type Arr = Unshift; // [0, 1, 2, 3] ```
写得烂了点 ```ts type FaslyUnion = 0 | "" | false | 0n | null | undefined; type AnyOfUnion = FaslyUnion | []; type IsEmptyObject = T extends {} ? ({}...
运用以前的Split和JoinStrArray ```ts type Replace< S extends string, From extends string, To extends string > = S extends `${infer H}${From}${infer R}` ? `${H}${To}${R}` : S; type ReplaceAll< S extends string, From...
```ts interface Example { a: string; e: number; b: string | number; c: () => void; d: {}; f: string | number | boolean; } type ConditionalPick = { [K...