getContainingList: Handle TypeAliasDeclaration (#25614)

* getContainingList: Handle TypeAliasDeclaration

* Handle ClassExpression and InterfaceDeclaration
This commit is contained in:
Andy
2018-07-13 10:30:22 -07:00
committed by GitHub
parent 27da9eab8d
commit 3f4412b173
2 changed files with 13 additions and 2 deletions
+4 -1
View File
@@ -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; };`,
});