@@ -84,6 +84,7 @@ namespace ts.formatting {
8484 public NoSpaceBeforeComma : Rule ;
8585
8686 public SpaceAfterCertainKeywords : Rule ;
87+ public NoSpaceAfterNewKeywordOnConstructorSignature : Rule ;
8788 public SpaceAfterLetConstInVariableDeclaration : Rule ;
8889 public NoSpaceBeforeOpenParenInFuncCall : Rule ;
8990 public SpaceAfterFunctionInFuncDecl : Rule ;
@@ -334,6 +335,7 @@ namespace ts.formatting {
334335 this . NoSpaceBeforeComma = new Rule ( RuleDescriptor . create2 ( Shared . TokenRange . Any , SyntaxKind . CommaToken ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsNonJsxSameLineTokenContext ) , RuleAction . Delete ) ) ;
335336
336337 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 ) ) ;
337339 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 ) ) ;
338340 this . NoSpaceBeforeOpenParenInFuncCall = new Rule ( RuleDescriptor . create2 ( Shared . TokenRange . Any , SyntaxKind . OpenParenToken ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsNonJsxSameLineTokenContext , Rules . IsFunctionCallOrNewContext , Rules . IsPreviousTokenNotComma ) , RuleAction . Delete ) ) ;
339341 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 {
530532 this . SpaceBeforeAt ,
531533 this . NoSpaceAfterAt ,
532534 this . SpaceAfterDecorator ,
533- this . NoSpaceBeforeNonNullAssertionOperator
535+ this . NoSpaceBeforeNonNullAssertionOperator ,
536+ this . NoSpaceAfterNewKeywordOnConstructorSignature
534537 ] ;
535538
536539 // These rules are applied after high priority rules.
@@ -881,6 +884,10 @@ namespace ts.formatting {
881884 return context . contextNode . kind === SyntaxKind . TypeLiteral ; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration;
882885 }
883886
887+ static IsConstructorSignatureContext ( context : FormattingContext ) : boolean {
888+ return context . contextNode . kind === SyntaxKind . ConstructSignature ;
889+ }
890+
884891 static IsTypeArgumentOrParameterOrAssertion ( token : TextRangeWithKind , parent : Node ) : boolean {
885892 if ( token . kind !== SyntaxKind . LessThanToken && token . kind !== SyntaxKind . GreaterThanToken ) {
886893 return false ;
0 commit comments