@@ -52,7 +52,7 @@ namespace ts.formatting {
52
52
53
53
rule ( "NotSpaceBeforeColon" , anyToken , SyntaxKind . ColonToken , [ isNonJsxSameLineTokenContext , isNotBinaryOpContext , isNotTypeAnnotationContext ] , RuleAction . DeleteSpace ) ,
54
54
rule ( "SpaceAfterColon" , SyntaxKind . ColonToken , anyToken , [ isNonJsxSameLineTokenContext , isNotBinaryOpContext ] , RuleAction . InsertSpace ) ,
55
- rule ( "NoSpaceBeforeQuestionMark" , anyToken , SyntaxKind . QuestionToken , [ isNonJsxSameLineTokenContext , isNotBinaryOpContext ] , RuleAction . DeleteSpace ) ,
55
+ rule ( "NoSpaceBeforeQuestionMark" , anyToken , SyntaxKind . QuestionToken , [ isNonJsxSameLineTokenContext , isNotBinaryOpContext , isNotTypeAnnotationContext ] , RuleAction . DeleteSpace ) ,
56
56
// insert space after '?' only when it is used in conditional operator
57
57
rule ( "SpaceAfterQuestionMarkInConditionalOperator" , SyntaxKind . QuestionToken , anyToken , [ isNonJsxSameLineTokenContext , isConditionalOperatorContext ] , RuleAction . InsertSpace ) ,
58
58
@@ -315,8 +315,9 @@ namespace ts.formatting {
315
315
rule ( "SpaceAfterTypeAssertion" , SyntaxKind . GreaterThanToken , anyToken , [ isOptionEnabled ( "insertSpaceAfterTypeAssertion" ) , isNonJsxSameLineTokenContext , isTypeAssertionContext ] , RuleAction . InsertSpace ) ,
316
316
rule ( "NoSpaceAfterTypeAssertion" , SyntaxKind . GreaterThanToken , anyToken , [ isOptionDisabledOrUndefined ( "insertSpaceAfterTypeAssertion" ) , isNonJsxSameLineTokenContext , isTypeAssertionContext ] , RuleAction . DeleteSpace ) ,
317
317
318
- rule ( "SpaceBeforeTypeAnnotation" , anyToken , SyntaxKind . ColonToken , [ isOptionEnabled ( "insertSpaceBeforeTypeAnnotation" ) , isNonJsxSameLineTokenContext , isTypeAnnotationContext ] , RuleAction . InsertSpace ) ,
319
- rule ( "NoSpaceBeforeTypeAnnotation" , anyToken , SyntaxKind . ColonToken , [ isOptionDisabledOrUndefined ( "insertSpaceBeforeTypeAnnotation" ) , isNonJsxSameLineTokenContext , isTypeAnnotationContext ] , RuleAction . DeleteSpace ) ,
318
+ rule ( "SpaceBeforeTypeAnnotation" , anyToken , [ SyntaxKind . QuestionToken , SyntaxKind . ColonToken ] , [ isOptionEnabled ( "insertSpaceBeforeTypeAnnotation" ) , isNonJsxSameLineTokenContext , isTypeAnnotationContext ] , RuleAction . InsertSpace ) ,
319
+ rule ( "NoSpaceBeforeTypeAnnotation" , anyToken , [ SyntaxKind . QuestionToken , SyntaxKind . ColonToken ] , [ isOptionDisabledOrUndefined ( "insertSpaceBeforeTypeAnnotation" ) , isNonJsxSameLineTokenContext , isTypeAnnotationContext ] , RuleAction . DeleteSpace ) ,
320
+
320
321
rule ( "NoOptionalSemicolon" , SyntaxKind . SemicolonToken , anyTokenIncludingEOF , [ optionEquals ( "semicolons" , SemicolonPreference . Remove ) , isSemicolonDeletionContext ] , RuleAction . DeleteToken ) ,
321
322
rule ( "OptionalSemicolon" , anyToken , anyTokenIncludingEOF , [ optionEquals ( "semicolons" , SemicolonPreference . Insert ) , isSemicolonInsertionContext ] , RuleAction . InsertTrailingSemicolon ) ,
322
323
] ;
0 commit comments