main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | import { Depth } from './_Internal';
|
---|
2 | import { _Pick } from './Pick';
|
---|
3 | import { Key } from '../Any/Key';
|
---|
4 | import { PatchFlat } from './Patch';
|
---|
5 | import { BuiltIn } from '../Misc/BuiltIn';
|
---|
6 | /**
|
---|
7 | * @hidden
|
---|
8 | */
|
---|
9 | export declare type UndefinableFlat<O> = {
|
---|
10 | [K in keyof O]: O[K] | undefined;
|
---|
11 | } & {};
|
---|
12 | /**
|
---|
13 | * @hidden
|
---|
14 | */
|
---|
15 | export declare type UndefinableDeep<O> = {
|
---|
16 | [K in keyof O]: O[K] extends BuiltIn ? O[K] : UndefinableDeep<O[K] | undefined>;
|
---|
17 | };
|
---|
18 | /**
|
---|
19 | * @hidden
|
---|
20 | */
|
---|
21 | declare type UndefinablePart<O extends object, depth extends Depth> = {
|
---|
22 | 'flat': UndefinableFlat<O>;
|
---|
23 | 'deep': UndefinableDeep<O>;
|
---|
24 | }[depth];
|
---|
25 | /**
|
---|
26 | * @hidden
|
---|
27 | */
|
---|
28 | export declare type _Undefinable<O extends object, K extends Key, depth extends Depth> = PatchFlat<UndefinablePart<_Pick<O, K>, depth>, O>;
|
---|
29 | /**
|
---|
30 | * Make some fields of `O` `undefined` (deeply or not)
|
---|
31 | * @param O to make undefinable
|
---|
32 | * @param K (?=`Key`) to choose fields
|
---|
33 | * @param depth (?=`'flat'`) 'deep' to do it deeply
|
---|
34 | * @returns [[Object]]
|
---|
35 | * @example
|
---|
36 | * ```ts
|
---|
37 | * ```
|
---|
38 | */
|
---|
39 | export declare type Undefinable<O extends object, K extends Key = Key, depth extends Depth = 'flat'> = O extends unknown ? _Undefinable<O, K, depth> : never;
|
---|
40 | export {};
|
---|
Note:
See
TracBrowser
for help on using the repository browser.