[d24f17c] | 1 | import { _Pick } from './Pick';
|
---|
| 2 | import { Depth } from './_Internal';
|
---|
| 3 | import { Key } from '../Any/Key';
|
---|
| 4 | import { NonNullable } from '../Union/NonNullable';
|
---|
| 5 | import { PatchFlat } from './Patch';
|
---|
| 6 | import { BuiltIn } from '../Misc/BuiltIn';
|
---|
| 7 | /**
|
---|
| 8 | * @hidden
|
---|
| 9 | */
|
---|
| 10 | export declare type CompulsoryFlat<O> = {
|
---|
| 11 | [K in keyof O]-?: NonNullable<O[K]>;
|
---|
| 12 | } & {};
|
---|
| 13 | /**
|
---|
| 14 | * @hidden
|
---|
| 15 | */
|
---|
| 16 | export declare type CompulsoryDeep<O> = {
|
---|
| 17 | [K in keyof O]-?: O[K] extends BuiltIn ? O[K] : CompulsoryDeep<NonNullable<O[K]>>;
|
---|
| 18 | };
|
---|
| 19 | /**
|
---|
| 20 | * @hidden
|
---|
| 21 | */
|
---|
| 22 | export declare type CompulsoryPart<O extends object, depth extends Depth> = {
|
---|
| 23 | 'flat': CompulsoryFlat<O>;
|
---|
| 24 | 'deep': CompulsoryDeep<O>;
|
---|
| 25 | }[depth];
|
---|
| 26 | /**
|
---|
| 27 | * @hidden
|
---|
| 28 | */
|
---|
| 29 | export declare type _Compulsory<O extends object, K extends Key, depth extends Depth> = PatchFlat<CompulsoryPart<_Pick<O, K>, depth>, O>;
|
---|
| 30 | /**
|
---|
| 31 | * Make that `O`'s fields cannot be [[Nullable]] or [[Optional]] (it's like
|
---|
| 32 | * [[Required]] & [[NonNullable]] at once).
|
---|
| 33 | * @param O to make compulsory
|
---|
| 34 | * @param K (?=`Key`) to choose fields
|
---|
| 35 | * @param depth (?=`'flat'`) 'deep' to do it deeply
|
---|
| 36 | * @returns [[Object]]
|
---|
| 37 | * @example
|
---|
| 38 | * ```ts
|
---|
| 39 | * ```
|
---|
| 40 | */
|
---|
| 41 | export declare type Compulsory<O extends object, K extends Key = Key, depth extends Depth = 'flat'> = O extends unknown ? _Compulsory<O, K, depth> : never;
|
---|