mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-11 02:15:10 -05:00
Fix assertion: class reference location may be 'default' keyword instead of class name (#21630)
* Fix assertion: class reference location may be 'default' keyword instead of class name * Update API baselines
This commit is contained in:
@@ -2027,6 +2027,7 @@ namespace ts {
|
||||
|
||||
export interface ClassDeclaration extends ClassLikeDeclarationBase, DeclarationStatement {
|
||||
kind: SyntaxKind.ClassDeclaration;
|
||||
/** May be undefined in `export default class { ... }`. */
|
||||
name?: Identifier;
|
||||
}
|
||||
|
||||
|
||||
@@ -990,7 +990,7 @@ namespace ts.FindAllReferences.Core {
|
||||
const pusher = () => state.referenceAdder(search.symbol, search.location);
|
||||
|
||||
if (isClassLike(referenceLocation.parent)) {
|
||||
Debug.assert(referenceLocation.parent.name === referenceLocation);
|
||||
Debug.assert(referenceLocation.kind === SyntaxKind.DefaultKeyword || referenceLocation.parent.name === referenceLocation);
|
||||
// This is the class declaration containing the constructor.
|
||||
findOwnConstructorReferences(search.symbol, sourceFile, pusher());
|
||||
}
|
||||
|
||||
@@ -1266,6 +1266,7 @@ declare namespace ts {
|
||||
}
|
||||
interface ClassDeclaration extends ClassLikeDeclarationBase, DeclarationStatement {
|
||||
kind: SyntaxKind.ClassDeclaration;
|
||||
/** May be undefined in `export default class { ... }`. */
|
||||
name?: Identifier;
|
||||
}
|
||||
interface ClassExpression extends ClassLikeDeclarationBase, PrimaryExpression {
|
||||
|
||||
@@ -1266,6 +1266,7 @@ declare namespace ts {
|
||||
}
|
||||
interface ClassDeclaration extends ClassLikeDeclarationBase, DeclarationStatement {
|
||||
kind: SyntaxKind.ClassDeclaration;
|
||||
/** May be undefined in `export default class { ... }`. */
|
||||
name?: Identifier;
|
||||
}
|
||||
interface ClassExpression extends ClassLikeDeclarationBase, PrimaryExpression {
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
////export default class {
|
||||
//// [|constructor|]() {}
|
||||
////}
|
||||
|
||||
verify.singleReferenceGroup("constructor default(): default");
|
||||
Reference in New Issue
Block a user