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 { Nullable as UNullable } from '../Union/Nullable';
|
---|
2 | import { Depth } from './_Internal';
|
---|
3 | import { _Pick } from './Pick';
|
---|
4 | import { Key } from '../Any/Key';
|
---|
5 | import { PatchFlat } from './Patch';
|
---|
6 | /**
|
---|
7 | * @hidden
|
---|
8 | */
|
---|
9 | export declare type NullableFlat<O> = {
|
---|
10 | [K in keyof O]: UNullable<O[K]>;
|
---|
11 | } & {};
|
---|
12 | /**
|
---|
13 | * @hidden
|
---|
14 | */
|
---|
15 | export declare type NullableDeep<O> = {
|
---|
16 | [K in keyof O]: NullableDeep<UNullable<O[K]>>;
|
---|
17 | };
|
---|
18 | /**
|
---|
19 | * @hidden
|
---|
20 | */
|
---|
21 | declare type NullablePart<O extends object, depth extends Depth> = {
|
---|
22 | 'flat': NullableFlat<O>;
|
---|
23 | 'deep': NullableDeep<O>;
|
---|
24 | }[depth];
|
---|
25 | /**
|
---|
26 | * @hidden
|
---|
27 | */
|
---|
28 | export declare type _Nullable<O extends object, K extends Key, depth extends Depth> = PatchFlat<NullablePart<_Pick<O, K>, depth>, O>;
|
---|
29 | /**
|
---|
30 | * Make some fields of `O` nullable (deeply or not)
|
---|
31 | * @param O to make nullable
|
---|
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 Nullable<O extends object, K extends Key = Key, depth extends Depth = 'flat'> = O extends unknown ? _Nullable<O, K, depth> : never;
|
---|
40 | export {};
|
---|
Note:
See
TracBrowser
for help on using the repository browser.