@@ -358,7 +358,7 @@ namespace ts.formatting {
358
358
this . NoSpaceAfterModuleImport = new Rule ( RuleDescriptor . create2 ( Shared . TokenRange . FromTokens ( [ SyntaxKind . ModuleKeyword , SyntaxKind . RequireKeyword ] ) , SyntaxKind . OpenParenToken ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsNonJsxSameLineTokenContext ) , RuleAction . Delete ) ) ;
359
359
360
360
// Add a space around certain TypeScript keywords
361
- this . SpaceAfterCertainTypeScriptKeywords = new Rule ( RuleDescriptor . create4 ( Shared . TokenRange . FromTokens ( [ SyntaxKind . AbstractKeyword , SyntaxKind . ClassKeyword , SyntaxKind . DeclareKeyword , SyntaxKind . DefaultKeyword , SyntaxKind . EnumKeyword , SyntaxKind . ExportKeyword , SyntaxKind . ExtendsKeyword , SyntaxKind . GetKeyword , SyntaxKind . ImplementsKeyword , SyntaxKind . ImportKeyword , SyntaxKind . InterfaceKeyword , SyntaxKind . ModuleKeyword , SyntaxKind . NamespaceKeyword , SyntaxKind . PrivateKeyword , SyntaxKind . PublicKeyword , SyntaxKind . ProtectedKeyword , SyntaxKind . SetKeyword , SyntaxKind . StaticKeyword , SyntaxKind . TypeKeyword , SyntaxKind . FromKeyword ] ) , Shared . TokenRange . Any ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsNonJsxSameLineTokenContext ) , RuleAction . Space ) ) ;
361
+ this . SpaceAfterCertainTypeScriptKeywords = new Rule ( RuleDescriptor . create4 ( Shared . TokenRange . FromTokens ( [ SyntaxKind . AbstractKeyword , SyntaxKind . ClassKeyword , SyntaxKind . DeclareKeyword , SyntaxKind . DefaultKeyword , SyntaxKind . EnumKeyword , SyntaxKind . ExportKeyword , SyntaxKind . ExtendsKeyword , SyntaxKind . GetKeyword , SyntaxKind . ImplementsKeyword , SyntaxKind . ImportKeyword , SyntaxKind . InterfaceKeyword , SyntaxKind . ModuleKeyword , SyntaxKind . NamespaceKeyword , SyntaxKind . PrivateKeyword , SyntaxKind . PublicKeyword , SyntaxKind . ProtectedKeyword , SyntaxKind . SetKeyword , SyntaxKind . StaticKeyword , SyntaxKind . TypeKeyword , SyntaxKind . FromKeyword , SyntaxKind . KeyOfKeyword ] ) , Shared . TokenRange . Any ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsNonJsxSameLineTokenContext ) , RuleAction . Space ) ) ;
362
362
this . SpaceBeforeCertainTypeScriptKeywords = new Rule ( RuleDescriptor . create4 ( Shared . TokenRange . Any , Shared . TokenRange . FromTokens ( [ SyntaxKind . ExtendsKeyword , SyntaxKind . ImplementsKeyword , SyntaxKind . FromKeyword ] ) ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsNonJsxSameLineTokenContext ) , RuleAction . Space ) ) ;
363
363
364
364
// Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" {
@@ -575,6 +575,8 @@ namespace ts.formatting {
575
575
return context . currentTokenSpan . kind === SyntaxKind . EqualsToken || context . nextTokenSpan . kind === SyntaxKind . EqualsToken ;
576
576
// "in" keyword in for (let x in []) { }
577
577
case SyntaxKind . ForInStatement :
578
+ // "in" keyword in [P in keyof T]: T[P]
579
+ case SyntaxKind . TypeParameter :
578
580
return context . currentTokenSpan . kind === SyntaxKind . InKeyword || context . nextTokenSpan . kind === SyntaxKind . InKeyword ;
579
581
// Technically, "of" is not a binary operator, but format it the same way as "in"
580
582
case SyntaxKind . ForOfStatement :
0 commit comments