mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
getContainingList: Handle TypeAliasDeclaration (#25614)
* getContainingList: Handle TypeAliasDeclaration * Handle ClassExpression and InterfaceDeclaration
This commit is contained in:
@@ -351,7 +351,10 @@ namespace ts.formatting {
|
||||
getListIfStartEndIsInListRange((<SignatureDeclaration>node.parent).parameters, start, end);
|
||||
}
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
return getListIfStartEndIsInListRange((<ClassDeclaration>node.parent).typeParameters, node.getStart(sourceFile), end);
|
||||
case SyntaxKind.ClassExpression:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
return getListIfStartEndIsInListRange((<ClassDeclaration | ClassExpression | InterfaceDeclaration | TypeAliasDeclaration>node.parent).typeParameters, node.getStart(sourceFile), end);
|
||||
case SyntaxKind.NewExpression:
|
||||
case SyntaxKind.CallExpression: {
|
||||
const start = node.getStart(sourceFile);
|
||||
|
||||
@@ -37,6 +37,10 @@
|
||||
////for (let i = 0, j = 0; ;) {}
|
||||
////for (const x of []) {}
|
||||
////for (const y in {}) {}
|
||||
////
|
||||
////export type First<T, U> = T;
|
||||
////export interface ISecond<T, U> { u: U; }
|
||||
////export const cls = class<T, U> { u: U; };
|
||||
|
||||
verify.codeFixAll({
|
||||
fixId: "unusedIdentifier_delete",
|
||||
@@ -70,5 +74,9 @@ takesCb((x, y) => { y; });
|
||||
}
|
||||
for (; ;) {}
|
||||
for (const {} of []) {}
|
||||
for (const {} in {}) {}`,
|
||||
for (const {} in {}) {}
|
||||
|
||||
export type First<T> = T;
|
||||
export interface ISecond<U> { u: U; }
|
||||
export const cls = class<U> { u: U; };`,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user