source: node_modules/ts-toolbelt/out/Object/Compulsory.d.ts

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.2 KB
RevLine 
[d24f17c]1import { _Pick } from './Pick';
2import { Depth } from './_Internal';
3import { Key } from '../Any/Key';
4import { NonNullable } from '../Union/NonNullable';
5import { PatchFlat } from './Patch';
6import { BuiltIn } from '../Misc/BuiltIn';
7/**
8 * @hidden
9 */
10export declare type CompulsoryFlat<O> = {
11 [K in keyof O]-?: NonNullable<O[K]>;
12} & {};
13/**
14 * @hidden
15 */
16export declare type CompulsoryDeep<O> = {
17 [K in keyof O]-?: O[K] extends BuiltIn ? O[K] : CompulsoryDeep<NonNullable<O[K]>>;
18};
19/**
20 * @hidden
21 */
22export declare type CompulsoryPart<O extends object, depth extends Depth> = {
23 'flat': CompulsoryFlat<O>;
24 'deep': CompulsoryDeep<O>;
25}[depth];
26/**
27 * @hidden
28 */
29export 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 */
41export declare type Compulsory<O extends object, K extends Key = Key, depth extends Depth = 'flat'> = O extends unknown ? _Compulsory<O, K, depth> : never;
Note: See TracBrowser for help on using the repository browser.