Function: asOneOf()
asOneOf<
T
>(values
,options
?):TTransformer
<T
[number
],TUnion
<TLiteral
<T
[number
]>[]>>
Create an oneOf transformer. Value must be parsable as one of the given values.
Type Parameters
Type Parameter |
---|
T extends TLiteralValue [] |
Parameters
Parameter | Type | Description |
---|---|---|
values | readonly [T ] | An array of expected values |
options ? | SchemaOptions | Validation options (see NumberOptions) |
Returns
TTransformer
<T
[number
], TUnion
<TLiteral
<T
[number
]>[]>>
Example
ts
Column('createdAt', asOneOf(['Todo', 'Doing', 'Done']));