nr ревизий этого фрагмента 2 days ago. К ревизии
1 file changed, 18 insertions
recursive-partial.ts(файл создан)
| @@ -0,0 +1,18 @@ | |||
| 1 | + | /** | |
| 2 | + | * ... then taken from | |
| 3 | + | * https://github.com/Noah2610/sync-tracker/blob/develop/lib/util/recursive-partial.ts | |
| 4 | + | */ | |
| 5 | + | ||
| 6 | + | /** | |
| 7 | + | * Taken from Tone.js, which itself was taken from here: | |
| 8 | + | * https://stackoverflow.com/a/51365037 | |
| 9 | + | */ | |
| 10 | + | type RecursivePartial<T> = { | |
| 11 | + | [P in keyof T]?: T[P] extends Array<infer U> | |
| 12 | + | ? Array<RecursivePartial<U>> | |
| 13 | + | : T[P] extends object | |
| 14 | + | ? RecursivePartial<T[P]> | |
| 15 | + | : T[P]; | |
| 16 | + | }; | |
| 17 | + | ||
| 18 | + | export default RecursivePartial; | |
nr ревизий этого фрагмента 2 days ago. К ревизии
1 file changed, 11 insertions
recursivePartial.ts(файл создан)
| @@ -0,0 +1,11 @@ | |||
| 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 | + | }; | |