source: node_modules/ts-toolbelt/out/Object/NonNullable.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.3 KB
Line 
1import { NonNullable as UNonNullable } from '../Union/NonNullable';
2import { Depth } from './_Internal';
3import { _Pick } from './Pick';
4import { Key } from '../Any/Key';
5import { PatchFlat } from './Patch';
6import { BuiltIn } from '../Misc/BuiltIn';
7/**
8 * @hidden
9 */
10export declare type NonNullableFlat<O> = {
11 [K in keyof O]: UNonNullable<O[K]>;
12} & {};
13/**
14 * @hidden
15 */
16export declare type NonNullableDeep<O> = {
17 [K in keyof O]: O[K] extends BuiltIn ? O[K] : NonNullableDeep<UNonNullable<O[K]>>;
18};
19/**
20 * @hidden
21 */
22export declare type NonNullablePart<O extends object, depth extends Depth> = {
23 'flat': NonNullableFlat<O>;
24 'deep': NonNullableDeep<O>;
25}[depth];
26/**
27 * @hidden
28 */
29export declare type _NonNullable<O extends object, K extends Key, depth extends Depth> = PatchFlat<NonNullablePart<_Pick<O, K>, depth>, O>;
30/**
31 * Make some fields of `O` not nullable (deeply or not)
32 * (Optional fields will be left untouched & `undefined`)
33 * @param O to make non nullable
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 NonNullable<O extends object, K extends Key = Key, depth extends Depth = 'flat'> = O extends unknown ? _NonNullable<O, K, depth> : never;
Note: See TracBrowser for help on using the repository browser.