Skip to content

narrowTypeByInstanceof understands ctor funcs - #27551

Merged
Nathan Shively-Sanders (sandersn) merged 3 commits into
masterfrom
js/fix-ctor-func-narrowing
Oct 4, 2018
Merged

Nathan Shively-Sanders (sandersn) merged 3 commits into
masterfrom
js/fix-ctor-func-narrowing

Conversation

@sandersn

Copy link
Copy Markdown
Member

Fixes #27550.

I'm going to try writing getEffectiveConstructSignatures as an intermediate step to constructor functions having construct signatures instead of call signatures, but that may break a bunch of code if used everywhere getSignaturesOfType(..., SignatureKind.Construct) is called today. For now, this fixes the bug in a targetted way.

@weswigham Wesley Wigham (weswigham) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you have a small lint error to fix. The "effective constructor signatures" change is probably going to require a change to #27403 as well.

@sandersn

Copy link
Copy Markdown
Member Author

I'm not sure about #27403 -- constructor functions are still functions, so isTypeDerivedFrom shouldn't need to change for constructor functions.

@weswigham

Copy link
Copy Markdown
Member

Fair enough - I guess it'd only matter if the signatures came from somewhere other than the other kind of signatures on the type itself.

@sandersn
Nathan Shively-Sanders (sandersn) deleted the js/fix-ctor-func-narrowing branch October 4, 2018 20:52
@microsoft Microsoft (microsoft) locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

#27370 breaks narrowing for constructor functions

2 participants