1 | import { Key } from './_Internal';
|
2 | import { AtLeast as OAtLeast } from '../Object/AtLeast';
|
3 | import { ObjectOf } from './ObjectOf';
|
4 | import { _ListOf } from '../Object/ListOf';
|
5 | import { List } from './List';
|
6 | import { Keys } from '../Any/Keys';
|
7 | /**
|
8 | * Make that at least one of the keys `K` are required in `L` at a time.
|
9 | * @param L to make required
|
10 | * @param K (?=`keyof L`) to choose fields
|
11 | * @returns [[List]] [[Union]]
|
12 | * @example
|
13 | * ```ts
|
14 | * import {L} from 'ts-toolbelt'
|
15 | *
|
16 | * type test0 = L.AtLeast<[1, 2, 3], 0> // [1, 2 | undefined, 3 | undefined]
|
17 | * type test1 = L.AtLeast<[1, 2, 3], 0 | 1> // [1, 2 | undefined, 3 | undefined] | [1 | undefined, 2, 3 | undefined]
|
18 | * type test2 = L.AtLeast<[1, 2, 3]>
|
19 | * // | [1, 2, 3]
|
20 | * // | [1, 2 | undefined, 3 | undefined]
|
21 | * // | [1 | undefined, 2, 3 | undefined]
|
22 | * // | [1 | undefined, 2 | undefined, 3]
|
23 | * ```
|
24 | */
|
25 | export declare type AtLeast<L extends List, K extends Key = Keys<L>> = OAtLeast<ObjectOf<L>, `${K & number}` | K> extends infer U ? U extends unknown ? _ListOf<U & {}> : never : never;
|