Skip to content

Disallow calls on never type#19726

Merged
ahejlsberg merged 3 commits into
masterfrom
fixNeverTypeCall
Nov 3, 2017
Merged

Disallow calls on never type#19726
ahejlsberg merged 3 commits into
masterfrom
fixNeverTypeCall

Conversation

@ahejlsberg
Copy link
Copy Markdown
Member

Fixes #11412.

Comment thread src/compiler/checker.ts
return false;
// We exclude union types because we may have a union of function types that happen to have no common signatures.
return isTypeAny(funcType) || isTypeAny(apparentFuncType) && funcType.flags & TypeFlags.TypeParameter ||
!numCallSignatures && !numConstructSignatures && !(funcType.flags & (TypeFlags.Union | TypeFlags.Never)) && isTypeAssignableTo(funcType, globalFunctionType);
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.

Strongly prefer the old style, but seems reasonable.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

You're too imperative, Daniel!

@ahejlsberg ahejlsberg merged commit f75a1dc into master Nov 3, 2017
@ahejlsberg ahejlsberg deleted the fixNeverTypeCall branch November 3, 2017 22:39
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
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.

3 participants