Allow type-only namespace imports in implements clauses#36464
Allow type-only namespace imports in implements clauses#36464andrewbranch merged 3 commits intomicrosoft:masterfrom
Conversation
| } | ||
|
|
||
| export function isFirstIdentifierOfImplementsClause(node: Node) { | ||
| return node.parent?.parent?.parent?.kind === SyntaxKind.HeritageClause |
There was a problem hiding this comment.
why does it have to be the first identifier? Why can't it be anywhere?
(That long chain of ?.s gives me the shivers.)
There was a problem hiding this comment.
Because this is a hot path and any other location in the node will be covered by other criteria of isValidTypeOnlyAliasUseSite, so it doesn’t make sense to check more than necessary.
node could be an identifier at the top level of a SourceFile, so I think that’d be SourceFile > ExpressionStatement > Identifier, so I guess only the last ?. is needed.
There was a problem hiding this comment.
Also I don't think it checks the scenario of type ? types.SomeInterfaceContainingNamespace.Component since its parent is going to be one more level up than just types.Component ?
There was a problem hiding this comment.
any other location in the node will be covered by other criteria of isValidTypeOnlyAliasUseSite,
double checking that this is true
There was a problem hiding this comment.
@sheetalkamat this only gets called on identifiers from resolveName, which will only be the left-most identifier. The other parts of entity names get checked elsewhere.
Fixes #36428