Skip to content

Commit 857d1e0

Browse files
Fixed case for index signatures.
1 parent b4811fc commit 857d1e0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/services/formatting/smartIndenter.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -491,11 +491,17 @@ module ts.formatting {
491491

492492
case SyntaxKind.ArrayLiteralExpression:
493493
case SyntaxKind.ArrayBindingPattern:
494-
case SyntaxKind.IndexSignature:
495494
case SyntaxKind.ComputedPropertyName:
496495
case SyntaxKind.TupleType:
497496
return nodeEndsWith(n, SyntaxKind.CloseBracketToken, sourceFile);
498497

498+
case SyntaxKind.IndexSignature:
499+
if ((<IndexSignatureDeclaration>n).type) {
500+
return isCompletedNode((<IndexSignatureDeclaration>n).type, sourceFile);
501+
}
502+
503+
return hasChildOfKind(n, SyntaxKind.CloseBracketToken, sourceFile);
504+
499505
case SyntaxKind.CaseClause:
500506
case SyntaxKind.DefaultClause:
501507
// there is no such thing as terminator token for CaseClause/DefaultClause so for simplicitly always consider them non-completed

0 commit comments

Comments
 (0)