@@ -84,6 +84,7 @@ namespace ts.formatting {
84
84
public NoSpaceBeforeComma : Rule ;
85
85
86
86
public SpaceAfterCertainKeywords : Rule ;
87
+ public NoSpaceAfterNewKeywordOnConstructorSignature : Rule ;
87
88
public SpaceAfterLetConstInVariableDeclaration : Rule ;
88
89
public NoSpaceBeforeOpenParenInFuncCall : Rule ;
89
90
public SpaceAfterFunctionInFuncDecl : Rule ;
@@ -334,6 +335,7 @@ namespace ts.formatting {
334
335
this . NoSpaceBeforeComma = new Rule ( RuleDescriptor . create2 ( Shared . TokenRange . Any , SyntaxKind . CommaToken ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsNonJsxSameLineTokenContext ) , RuleAction . Delete ) ) ;
335
336
336
337
this . SpaceAfterCertainKeywords = new Rule ( RuleDescriptor . create4 ( Shared . TokenRange . FromTokens ( [ SyntaxKind . VarKeyword , SyntaxKind . ThrowKeyword , SyntaxKind . NewKeyword , SyntaxKind . DeleteKeyword , SyntaxKind . ReturnKeyword , SyntaxKind . TypeOfKeyword , SyntaxKind . AwaitKeyword ] ) , Shared . TokenRange . Any ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsNonJsxSameLineTokenContext ) , RuleAction . Space ) ) ;
338
+ this . NoSpaceAfterNewKeywordOnConstructorSignature = new Rule ( RuleDescriptor . create1 ( SyntaxKind . NewKeyword , SyntaxKind . OpenParenToken ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsNonJsxSameLineTokenContext , Rules . IsConstructorSignatureContext ) , RuleAction . Delete ) ) ;
337
339
this . SpaceAfterLetConstInVariableDeclaration = new Rule ( RuleDescriptor . create4 ( Shared . TokenRange . FromTokens ( [ SyntaxKind . LetKeyword , SyntaxKind . ConstKeyword ] ) , Shared . TokenRange . Any ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsNonJsxSameLineTokenContext , Rules . IsStartOfVariableDeclarationList ) , RuleAction . Space ) ) ;
338
340
this . NoSpaceBeforeOpenParenInFuncCall = new Rule ( RuleDescriptor . create2 ( Shared . TokenRange . Any , SyntaxKind . OpenParenToken ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsNonJsxSameLineTokenContext , Rules . IsFunctionCallOrNewContext , Rules . IsPreviousTokenNotComma ) , RuleAction . Delete ) ) ;
339
341
this . SpaceAfterFunctionInFuncDecl = new Rule ( RuleDescriptor . create3 ( SyntaxKind . FunctionKeyword , Shared . TokenRange . Any ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsFunctionDeclContext ) , RuleAction . Space ) ) ;
@@ -530,7 +532,8 @@ namespace ts.formatting {
530
532
this . SpaceBeforeAt ,
531
533
this . NoSpaceAfterAt ,
532
534
this . SpaceAfterDecorator ,
533
- this . NoSpaceBeforeNonNullAssertionOperator
535
+ this . NoSpaceBeforeNonNullAssertionOperator ,
536
+ this . NoSpaceAfterNewKeywordOnConstructorSignature
534
537
] ;
535
538
536
539
// These rules are applied after high priority rules.
@@ -881,6 +884,10 @@ namespace ts.formatting {
881
884
return context . contextNode . kind === SyntaxKind . TypeLiteral ; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration;
882
885
}
883
886
887
+ static IsConstructorSignatureContext ( context : FormattingContext ) : boolean {
888
+ return context . contextNode . kind === SyntaxKind . ConstructSignature ;
889
+ }
890
+
884
891
static IsTypeArgumentOrParameterOrAssertion ( token : TextRangeWithKind , parent : Node ) : boolean {
885
892
if ( token . kind !== SyntaxKind . LessThanToken && token . kind !== SyntaxKind . GreaterThanToken ) {
886
893
return false ;
0 commit comments