recursivePartial.ts
· 298 B · TypeScript
原始文件
/**
* https://github.com/Noah2610/i3-color-theme-editor/blob/master/src/util/recursivePartial.ts
*/
export type RecursivePartial<T> = {
[P in keyof T]?: T[P] extends (infer U)[]
? RecursivePartial<U>[]
: T[P] extends object
? RecursivePartial<T[P]>
: T[P];
};
| 1 | /** |
| 2 | * https://github.com/Noah2610/i3-color-theme-editor/blob/master/src/util/recursivePartial.ts |
| 3 | */ |
| 4 | |
| 5 | export type RecursivePartial<T> = { |
| 6 | [P in keyof T]?: T[P] extends (infer U)[] |
| 7 | ? RecursivePartial<U>[] |
| 8 | : T[P] extends object |
| 9 | ? RecursivePartial<T[P]> |
| 10 | : T[P]; |
| 11 | }; |