Skip to content

Commit 05b95c3

Browse files
committed
fixed formatting for equals token in type aliases
1 parent 60afbc1 commit 05b95c3

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/services/formatting/rules.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,11 @@ module ts.formatting {
458458
case SyntaxKind.BinaryExpression:
459459
case SyntaxKind.ConditionalExpression:
460460
return true;
461-
461+
462+
// equals in binding elements: function foo([[x, y] = [1, 2]])
463+
case SyntaxKind.BindingElement:
464+
// equals in type X = ...
465+
case SyntaxKind.TypeAliasDeclaration:
462466
// equal in import a = module('a');
463467
case SyntaxKind.ImportEqualsDeclaration:
464468
// equal in let a = 0;
@@ -475,8 +479,6 @@ module ts.formatting {
475479
// Technically, "of" is not a binary operator, but format it the same way as "in"
476480
case SyntaxKind.ForOfStatement:
477481
return context.currentTokenSpan.kind === SyntaxKind.OfKeyword || context.nextTokenSpan.kind === SyntaxKind.OfKeyword;
478-
case SyntaxKind.BindingElement:
479-
return context.currentTokenSpan.kind === SyntaxKind.EqualsToken || context.nextTokenSpan.kind === SyntaxKind.EqualsToken;
480482
}
481483
return false;
482484
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/// <reference path='fourslash.ts'/>
2+
3+
////type X = [number]/*1*/
4+
goTo.marker("1");
5+
edit.insert(";");
6+
verify.currentLineContentIs("type X = [number];");

0 commit comments

Comments
 (0)