#27370 breaks narrowing for constructor functions #27550
Labels
Bug
A bug in TypeScript
Domain: JavaScript
The issue relates to JavaScript specifically
Fixed
A PR has been merged for this issue
Based on code from uglify:
Expected behavior:
x
doesn't narrow inside the if andx: any
andx.val: any
.Actual behavior:
x
narrows tox: {}
and gives an error onx.val
.I think the reason is that constructor functions are special-cased in resolveCallExpression -- they still only have call signatures, not construct signatures. The code in narrowTypeByInstanceof probably needs the same special-casing (or to have it in one place).
The text was updated successfully, but these errors were encountered: