@@ -59,7 +59,7 @@ namespace ts.formatting {
59
59
// in other cases there should be no space between '?' and next token
60
60
rule ( "NoSpaceAfterQuestionMark" , SyntaxKind . QuestionToken , anyToken , [ isNonJsxSameLineTokenContext ] , RuleAction . DeleteSpace ) ,
61
61
62
- rule ( "NoSpaceBeforeDot" , anyToken , [ SyntaxKind . DotToken , SyntaxKind . QuestionDotToken ] , [ isNonJsxSameLineTokenContext ] , RuleAction . DeleteSpace ) ,
62
+ rule ( "NoSpaceBeforeDot" , anyToken , [ SyntaxKind . DotToken , SyntaxKind . QuestionDotToken ] , [ isNonJsxSameLineTokenContext , isNotPropertyAccessOnNumericLiteral ] , RuleAction . DeleteSpace ) ,
63
63
rule ( "NoSpaceAfterDot" , [ SyntaxKind . DotToken , SyntaxKind . QuestionDotToken ] , anyToken , [ isNonJsxSameLineTokenContext ] , RuleAction . DeleteSpace ) ,
64
64
65
65
rule ( "NoSpaceBetweenImportParenInImportType" , SyntaxKind . ImportKeyword , SyntaxKind . OpenParenToken , [ isNonJsxSameLineTokenContext , isImportTypeContext ] , RuleAction . DeleteSpace ) ,
@@ -893,4 +893,8 @@ namespace ts.formatting {
893
893
function isSemicolonInsertionContext ( context : FormattingContext ) : boolean {
894
894
return positionIsASICandidate ( context . currentTokenSpan . end , context . currentTokenParent , context . sourceFile ) ;
895
895
}
896
+
897
+ function isNotPropertyAccessOnNumericLiteral ( context : FormattingContext ) : boolean {
898
+ return ! isPropertyAccessExpression ( context . contextNode ) || ! isNumericLiteral ( context . contextNode . expression ) ;
899
+ }
896
900
}
0 commit comments