Fix space issue in mapped type formatting (#21712)

* Add the test for mapped type formatting issue

* Fix inconsistent number of spaces within braces when formatting mapped types
This commit is contained in:
Priyantha Lankapura
2018-02-07 22:53:31 +05:30
committed by Mohamed Hegazy
parent e0e2f5bd41
commit 4cfb7a5105
2 changed files with 39 additions and 1 deletions

View File

@@ -469,7 +469,9 @@ namespace ts.formatting {
}
function isBraceWrappedContext(context: FormattingContext): boolean {
return context.contextNode.kind === SyntaxKind.ObjectBindingPattern || isSingleLineBlockContext(context);
return context.contextNode.kind === SyntaxKind.ObjectBindingPattern ||
context.contextNode.kind === SyntaxKind.MappedType ||
isSingleLineBlockContext(context);
}
// This check is done before an open brace in a control construct, a function, or a typescript block declaration