Skip to content

Commit

Permalink
consider type only alias as valid for jsdoc context
Browse files Browse the repository at this point in the history
  • Loading branch information
a-tarasyuk committed Jan 17, 2025
1 parent 6586021 commit 82e76ec
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/compiler/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10454,6 +10454,7 @@ export function isValidBigIntString(s: string, roundTripOnly: boolean): boolean
/** @internal */
export function isValidTypeOnlyAliasUseSite(useSite: Node): boolean {
return !!(useSite.flags & NodeFlags.Ambient)
|| isInJSDoc(useSite)
|| isPartOfTypeQuery(useSite)
|| isIdentifierInNonEmittingHeritageClause(useSite)
|| isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(useSite)
Expand Down Expand Up @@ -10483,7 +10484,6 @@ function isIdentifierInNonEmittingHeritageClause(node: Node): boolean {
if (node.kind !== SyntaxKind.Identifier) return false;
const heritageClause = findAncestor(node.parent, parent => {
switch (parent.kind) {
case SyntaxKind.JSDocImplementsTag:
case SyntaxKind.HeritageClause:
return true;
case SyntaxKind.PropertyAccessExpression:
Expand All @@ -10493,8 +10493,7 @@ function isIdentifierInNonEmittingHeritageClause(node: Node): boolean {
return "quit";
}
}) as HeritageClause | undefined;
if (heritageClause === undefined) return false;
return isJSDocImplementsTag(heritageClause) || heritageClause.token === SyntaxKind.ImplementsKeyword || heritageClause.parent.kind === SyntaxKind.InterfaceDeclaration;
return heritageClause?.token === SyntaxKind.ImplementsKeyword || heritageClause?.parent.kind === SyntaxKind.InterfaceDeclaration;
}

/** @internal */
Expand Down

0 comments on commit 82e76ec

Please sign in to comment.