File tree 2 files changed +25
-0
lines changed
2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -1138,6 +1138,13 @@ namespace ts {
1138
1138
reportInvalidOptionValue ( option && option . type !== "number" ) ;
1139
1139
return Number ( ( < NumericLiteral > valueExpression ) . text ) ;
1140
1140
1141
+ case SyntaxKind . PrefixUnaryExpression :
1142
+ if ( ( < PrefixUnaryExpression > valueExpression ) . operator !== SyntaxKind . MinusToken || ( < PrefixUnaryExpression > valueExpression ) . operand . kind !== SyntaxKind . NumericLiteral ) {
1143
+ break ; // not valid JSON syntax
1144
+ }
1145
+ reportInvalidOptionValue ( option && option . type !== "number" ) ;
1146
+ return - Number ( ( < NumericLiteral > ( < PrefixUnaryExpression > valueExpression ) . operand ) . text ) ;
1147
+
1141
1148
case SyntaxKind . ObjectLiteralExpression :
1142
1149
reportInvalidOptionValue ( option && option . type !== "object" ) ;
1143
1150
const objectLiteralExpression = < ObjectLiteralExpression > valueExpression ;
Original file line number Diff line number Diff line change @@ -421,6 +421,24 @@ namespace ts {
421
421
) ;
422
422
} ) ;
423
423
424
+ it ( "Convert negative numbers in tsconfig.json " , ( ) => {
425
+ assertCompilerOptions (
426
+ {
427
+ "compilerOptions" : {
428
+ "allowJs" : true ,
429
+ "maxNodeModuleJsDepth" : - 1
430
+ }
431
+ } , "tsconfig.json" ,
432
+ {
433
+ compilerOptions : {
434
+ allowJs : true ,
435
+ maxNodeModuleJsDepth : - 1
436
+ } ,
437
+ errors : [ ]
438
+ }
439
+ ) ;
440
+ } ) ;
441
+
424
442
// jsconfig.json
425
443
it ( "Convert correctly format jsconfig.json to compiler-options " , ( ) => {
426
444
assertCompilerOptions (
You can’t perform that action at this time.
0 commit comments