@@ -3170,6 +3170,7 @@ function getExtendsConfigPathOrArray(
3170
3170
basePath : string ,
3171
3171
configFileName : string | undefined ,
3172
3172
errors : Diagnostic [ ] ,
3173
+ propertyAssignment ?: PropertyAssignment ,
3173
3174
valueExpression ?: Expression ,
3174
3175
sourceFile ?: JsonSourceFile ,
3175
3176
) {
@@ -3200,12 +3201,12 @@ function getExtendsConfigPathOrArray(
3200
3201
) ) ;
3201
3202
}
3202
3203
else {
3203
- convertJsonOption ( extendsOptionDeclaration . element , value , basePath , errors , ( valueExpression as ArrayLiteralExpression | undefined ) ?. elements [ index ] , sourceFile ) ;
3204
+ convertJsonOption ( extendsOptionDeclaration . element , value , basePath , errors , propertyAssignment , ( valueExpression as ArrayLiteralExpression | undefined ) ?. elements [ index ] , sourceFile ) ;
3204
3205
}
3205
3206
}
3206
3207
}
3207
3208
else {
3208
- convertJsonOption ( extendsOptionDeclaration , value , basePath , errors , valueExpression , sourceFile ) ;
3209
+ convertJsonOption ( extendsOptionDeclaration , value , basePath , errors , propertyAssignment , valueExpression , sourceFile ) ;
3209
3210
}
3210
3211
return extendedConfigPath ;
3211
3212
}
@@ -3248,7 +3249,7 @@ function parseOwnConfigOfJsonSourceFile(
3248
3249
option : CommandLineOption | undefined ,
3249
3250
) {
3250
3251
// Ensure value is verified except for extends which is handled in its own way for error reporting
3251
- if ( option && option !== extendsOptionDeclaration ) value = convertJsonOption ( option , value , basePath , errors , propertyAssignment . initializer , sourceFile ) ;
3252
+ if ( option && option !== extendsOptionDeclaration ) value = convertJsonOption ( option , value , basePath , errors , propertyAssignment , propertyAssignment . initializer , sourceFile ) ;
3252
3253
if ( parentOption ?. name ) {
3253
3254
if ( option ) {
3254
3255
let currentOption ;
@@ -3275,7 +3276,7 @@ function parseOwnConfigOfJsonSourceFile(
3275
3276
}
3276
3277
else if ( parentOption === rootOptions ) {
3277
3278
if ( option === extendsOptionDeclaration ) {
3278
- extendedConfigPath = getExtendsConfigPathOrArray ( value , host , basePath , configFileName , errors , propertyAssignment . initializer , sourceFile ) ;
3279
+ extendedConfigPath = getExtendsConfigPathOrArray ( value , host , basePath , configFileName , errors , propertyAssignment , propertyAssignment . initializer , sourceFile ) ;
3279
3280
}
3280
3281
else if ( ! option ) {
3281
3282
if ( keyText === "excludes" ) {
@@ -3458,18 +3459,23 @@ export function convertJsonOption(
3458
3459
value : any ,
3459
3460
basePath : string ,
3460
3461
errors : Diagnostic [ ] ,
3462
+ propertyAssignment ?: PropertyAssignment ,
3461
3463
valueExpression ?: Expression ,
3462
3464
sourceFile ?: TsConfigSourceFile ,
3463
3465
) : CompilerOptionsValue {
3466
+ if ( opt . isCommandLineOnly ) {
3467
+ errors . push ( createDiagnosticForNodeInSourceFileOrCompilerDiagnostic ( sourceFile , propertyAssignment ?. name , Diagnostics . Option_0_can_only_be_specified_on_command_line , opt . name ) ) ;
3468
+ return undefined ;
3469
+ }
3464
3470
if ( isCompilerOptionsValue ( opt , value ) ) {
3465
3471
const optType = opt . type ;
3466
3472
if ( ( optType === "list" ) && isArray ( value ) ) {
3467
- return convertJsonOptionOfListType ( opt , value , basePath , errors , valueExpression as ArrayLiteralExpression | undefined , sourceFile ) ;
3473
+ return convertJsonOptionOfListType ( opt , value , basePath , errors , propertyAssignment , valueExpression as ArrayLiteralExpression | undefined , sourceFile ) ;
3468
3474
}
3469
3475
else if ( optType === "listOrElement" ) {
3470
3476
return isArray ( value ) ?
3471
- convertJsonOptionOfListType ( opt , value , basePath , errors , valueExpression as ArrayLiteralExpression | undefined , sourceFile ) :
3472
- convertJsonOption ( opt . element , value , basePath , errors , valueExpression , sourceFile ) ;
3477
+ convertJsonOptionOfListType ( opt , value , basePath , errors , propertyAssignment , valueExpression as ArrayLiteralExpression | undefined , sourceFile ) :
3478
+ convertJsonOption ( opt . element , value , basePath , errors , propertyAssignment , valueExpression , sourceFile ) ;
3473
3479
}
3474
3480
else if ( ! isString ( opt . type ) ) {
3475
3481
return convertJsonOptionOfCustomType ( opt as CommandLineOptionOfCustomType , value as string , errors , valueExpression , sourceFile ) ;
@@ -3530,10 +3536,11 @@ function convertJsonOptionOfListType(
3530
3536
values : readonly any [ ] ,
3531
3537
basePath : string ,
3532
3538
errors : Diagnostic [ ] ,
3539
+ propertyAssignment : PropertyAssignment | undefined ,
3533
3540
valueExpression : ArrayLiteralExpression | undefined ,
3534
3541
sourceFile : TsConfigSourceFile | undefined ,
3535
3542
) : any [ ] {
3536
- return filter ( map ( values , ( v , index ) => convertJsonOption ( option . element , v , basePath , errors , valueExpression ?. elements [ index ] , sourceFile ) ) , v => option . listPreserveFalsyValues ? true : ! ! v ) ;
3543
+ return filter ( map ( values , ( v , index ) => convertJsonOption ( option . element , v , basePath , errors , propertyAssignment , valueExpression ?. elements [ index ] , sourceFile ) ) , v => option . listPreserveFalsyValues ? true : ! ! v ) ;
3537
3544
}
3538
3545
3539
3546
/**
0 commit comments