to make required
(?=keyof L
) to choose fields
List [[Union]]
import {L} from 'ts-toolbelt'
type test0 = L.AtLeast<[1, 2, 3], 0> // [1, 2 | undefined, 3 | undefined]
type test1 = L.AtLeast<[1, 2, 3], 0 | 1> // [1, 2 | undefined, 3 | undefined] | [1 | undefined, 2, 3 | undefined]
type test2 = L.AtLeast<[1, 2, 3]>
// | [1, 2, 3]
// | [1, 2 | undefined, 3 | undefined]
// | [1 | undefined, 2, 3 | undefined]
// | [1 | undefined, 2 | undefined, 3]
Make that at least one of the keys
K
are required inL
at a time.