Type discrimination in function calls for callable types doesn't work if discriminating property is optional #34529
Labels
Awaiting More Feedback
This means we'd like to hear from more people who would be helped by this feature
Suggestion
An idea for TypeScript
TypeScript Version: 3.7.0-dev.20191015
Search Terms: type discrimination, callable, signatures, implicit any
Code
Expected behavior:
x
should be inferred to benumber
.Actual behavior:
x
isany
.If you change
type?: 1
totype: 1
, it works as expected.Playground Link: link
Related Issues: #7294 (closed with #29011 - see second half of the original post, I believe it describes why this issue occurs)
The text was updated successfully, but these errors were encountered: