-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Simplify abstract constructor type assignability checking #6111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -15396,20 +15368,6 @@ namespace ts { | |||
return symbol && getExportSymbolOfValueSymbolIfExported(symbol).valueDeclaration; | |||
} | |||
|
|||
function instantiateSingleCallFunctionType(functionType: Type, typeArguments: Type[]): Type { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't lint unused functions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:1+: |
@@ -5782,6 +5740,20 @@ namespace ts { | |||
} | |||
} | |||
|
|||
// Return true if the given type is the constructor type for an abstract class | |||
function isAbstractConstructorType(type: Type) { | |||
if (type.flags & TypeFlags.Anonymous) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you elaborate why this needs to be anonymous?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the static side of a class is an anonymous object type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add that in as a quick comment then? It's not entirely obvious at first glance.
Other than my last comment, 👍 |
Simplify abstract constructor type assignability checking
This PR simplifies checking of abstract constructor type assignability. The current code is overly convoluted and inefficient and even includes some out of bounds indexing of arrays.