Describe the bugoneOf method on number schema emits type number instead of union of literals. Though if schema is string then emitted type is perfectly correct.
To Reproduce
import { number, string, type InferType } from 'yup';
const NumberOneOfSchema = number().oneOf([1, 2, 3]).required();
type NumberOneOf = InferType<typeof NumberOneOfSchema>; // number
const StringOneOfSchema = string().oneOf(['1', '2', '3']).required();
type StringOneOf = InferType<typeof StringOneOfSchema>; // '1' | '2' | '3'
Expected behavioroneOf's emmited type should be union of literals. E.g. type of NumberOneOf in example above should be 1 | 2 | 3.
Platform (please complete the following information):
Describe the bug
oneOf
method onnumber
schema emits typenumber
instead of union of literals. Though if schema isstring
then emitted type is perfectly correct.To Reproduce
Expected behavior
oneOf
's emmited type should be union of literals. E.g. type ofNumberOneOf
in example above should be1 | 2 | 3
.Platform (please complete the following information):