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 authored and Mohamed Hegazy committed 2018-02-07 09:23:31 -08:00
1 parent e0e2f5bd41
commit 4cfb7a5105
2 files changed
+39 -1

No files matched your search

+3 -1
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