Description
Describe the bug
For my project I have had to use the tsconfig
option and I have tried to use strict
mode, however two of the options I use in my configuration appear to be unknown/unsupported.
Here are the options that I am trying to use:
- emitDecoratorMetadata
-typeRoots
I will switch to minimal
for now, and report any compatibility issues should I encounter them.
That being said, how these options work seems to likely have little effect on the ability for JSII to operate. emitDecoratorMetadata
adds additional metadata to the reflected classes which does not effect code execution, and typeRoots
just allows TSC to be made aware of where typing information can be found if it isn't discoverable, which as far as I can tell will not affect runtime execution.
Expected Behavior
Configuration containing emitDecoratorMetadata
and typeRoots
passes strict
validation.
Current Behavior
We get the following error:
error JSII4000: Typescript compiler options in "tsconfig.json" are not passing validation against rule set "strict", found the following rule violations:
- outDir: Unexpected field, got: outDir
- emitDecoratorMetadata: Unexpected field, got: emitDecoratorMetadata
- typeRoots: Unexpected field, got: typeRoots
Reproduction Steps
Use the following tsconfig.json
file compilerOptions
:
"compilerOptions": {
"target": "ES2022",
"lib": ["ES2022"],
"module": "node16",
"moduleResolution": "node16",
"declaration": true,
"inlineSourceMap": true,
"outDir": "./dist",
"strict": true,
"esModuleInterop": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"strictBindCallApply": true,
"strictPropertyInitialization": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"strictNullChecks": true,
"stripInternal": false,
"composite": false,
"typeRoots": ["./node_modules/@types"],
"skipLibCheck": true,
"noEmitOnError": true
}
With the following settings in package.json
"jsii": {
"tsconfig": "tsconfig.json",
"validateTsConfig": "strict",
}
Possible Solution
Validate these settings are compatible with JSII and then add them to rules supported by the validator.
Additional Information/Context
No response
SDK version used
5.5.2
Environment details (OS name and version, etc.)
Linux/5.15.153.1-microsoft-standard-WSL2/SMP/x86_64