You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The type generated by isEnum behaves unexpectedly when nested inside isObject:
// works as expected:constsimpleEnum=t.isEnum(["a","b"]);// ->// t.StrictValidator<unknown, "a" | "b">// unexpected type widening:constenumInObject=t.isObject({enum: t.isEnum(["a","b"]),});// ->// t.StrictValidator<unknown, ToOptional<{// enum: string;// }>>
Current workarounds:
constworkaround1=t.isObject({enum: t.isEnum(["a"asconst,"b"asconst]),});// ->// t.StrictValidator<unknown, ToOptional<{// enum: "a" | "b";// }>>constworkaround2=t.isObject({enum: t.isOneOf([t.isLiteral("a"),t.isLiteral("b")]),});// ->// t.StrictValidator<unknown, ToOptional<{// enum: "a" | "b";// }>>
Possible workaround, but not yet working due to #7:
The type generated by
isEnum
behaves unexpectedly when nested insideisObject
:Current workarounds:
Possible workaround, but not yet working due to #7:
The text was updated successfully, but these errors were encountered: