[d24f17c] | 1 | import { Key } from './_Internal';
|
---|
| 2 | import { NonNullable as UNonNullable } from '../Union/NonNullable';
|
---|
| 3 | import { Depth } from '../Object/_Internal';
|
---|
| 4 | import { BuiltIn } from '../Misc/BuiltIn';
|
---|
| 5 | import { Cast } from '../Any/Cast';
|
---|
| 6 | import { List } from './List';
|
---|
| 7 | /**
|
---|
| 8 | * @hidden
|
---|
| 9 | */
|
---|
| 10 | export declare type NonNullableFlat<O, K extends Key = Key> = {
|
---|
| 11 | [P in keyof O]: P extends K ? UNonNullable<O[P]> : O[P];
|
---|
| 12 | } & {};
|
---|
| 13 | /**
|
---|
| 14 | * @hidden
|
---|
| 15 | */
|
---|
| 16 | declare type _NonNullableDeep<O> = {
|
---|
| 17 | [K in keyof O]: O[K] extends BuiltIn ? O[K] : NonNullableDeep<O[K], Key>;
|
---|
| 18 | };
|
---|
| 19 | /**
|
---|
| 20 | * @hidden
|
---|
| 21 | */
|
---|
| 22 | export declare type NonNullableDeep<O, K extends Key = Key> = _NonNullableDeep<NonNullableFlat<O, K>>;
|
---|
| 23 | /**
|
---|
| 24 | * @hidden
|
---|
| 25 | */
|
---|
| 26 | export declare type NonNullablePart<O extends object, K extends Key, depth extends Depth> = {
|
---|
| 27 | 'flat': NonNullableFlat<O, K>;
|
---|
| 28 | 'deep': NonNullableDeep<O, K>;
|
---|
| 29 | }[depth];
|
---|
| 30 | /**
|
---|
| 31 | * Make some entries of `L` not nullable (deeply or not)
|
---|
| 32 | * @param L to make non nullable
|
---|
| 33 | * @param K (?=`Key`) to choose fields
|
---|
| 34 | * @param depth (?=`'flat'`) 'deep' to do it deeply
|
---|
| 35 | * @returns [[List]]
|
---|
| 36 | * @example
|
---|
| 37 | * ```ts
|
---|
| 38 | * ```
|
---|
| 39 | */
|
---|
| 40 | export declare type NonNullable<L extends List, K extends Key = Key, depth extends Depth = 'flat'> = Cast<NonNullablePart<L, `${K & number}` | K, depth>, List>;
|
---|
| 41 | export {};
|
---|