Skip to content

constants

constants<T>(…consts): Dependent<T[number]>

A function that generates a dependent type for a given set of enumerated values.

Example

random(constants("foo", "bar"))
// => "foo"

Type Parameters

T extends unknown[]

Parameters

consts

…[...T[]]

The set of enumerated values to use.

Returns

Dependent<T[number]>

A dependent type that generates values from the provided set of enumerated values.