UNPKG

748 BTypeScriptView Raw
1import { Depth } from '../Object/_Internal';
2import { CompulsoryPart } from '../Object/Compulsory';
3import { List } from './List';
4import { Cast } from '../Any/Cast';
5/**
6 * Make that `L`'s fields cannot be [[Nullable]] or [[Optional]] (it's like
7 * [[Required]] & [[NonNullable]] at once).
8 * @param L to make compulsory
9 * @param depth (?=`'flat'`) 'deep' to do it deeply
10 * @returns [[List]]
11 * @example
12 * ```ts
13 * * import {L} from 'ts-toolbelt'
14 *
15 * type test0 = L.Compulsory<[1, 2, 3?, 4?]> // [1, 2, 3, 4]
16 * type test1 = L.Compulsory<['a', 'b' | undefined, 'c', 'd', 'e' | null]> // ['a', 'b', 'c', 'd', 'e']
17 * ```
18 */
19export declare type Compulsory<L extends List, depth extends Depth = 'flat'> = Cast<CompulsoryPart<L, depth>, List>;