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
Later, I want to switch on property data types, like so:
functionvalueToPropertyData<TextendsForge.PropertyData>(propertyType: T,value: PropertyDataToValue<T>,){switch(propertyType){caseForge.PropertyData.StringProperty:
// Here: `value` is of type PropertyDataToValue<T>return;}}
Expected behavior:
In the "case", I'd expect value to be inferred as a string type. Similarly for each conditional type.
Actual behavior:
In the "case", value is of type PropertyDataToValue
Uh oh!
There was an error while loading. Please reload this page.
TypeScript Version: 3.5.0-dev.20190515
Search Terms: conditional type, enum, value, switch, inference
Code
I have a conditional type mapping an enum descriptor to real types:
Later, I want to switch on property data types, like so:
Expected behavior:
In the "case", I'd expect
value
to be inferred as astring
type. Similarly for each conditional type.Actual behavior:
In the "case",
value
is of type PropertyDataToValuePlayground Link:
Playground URL
Related Issues:
I found this that seems related, but not quite: #23578
The text was updated successfully, but these errors were encountered: