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 test object with a type value of 2 should flag the string property as invalid, since it is not in IBase or IDate, but the object is considered valid.
π Expected behavior
The test object should infer its interface from the value of type. Any valid value could be an IBase, but a value of 2 should not be an IDate and a value of 3 should not be an IString.
The text was updated successfully, but these errors were encountered:
IIRC this is a limitation of excess property checking; if the property exists in any of the union constituents, it isn't flagged. Note that excess property errors are not type errors per se; TypeScript doesn't support exact types.
Bug Report
π Search Terms
"type infer", "conditional interface"
π Version & Regression Information
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
The
test
object with atype
value of2
should flag thestring
property as invalid, since it is not inIBase
orIDate
, but the object is considered valid.π Expected behavior
The
test
object should infer its interface from the value oftype
. Any valid value could be anIBase
, but a value of2
should not be anIDate
and a value of3
should not be anIString
.The text was updated successfully, but these errors were encountered: