Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validateTsConfig - strict definition options (typeRoots / emitDecoratorMetadata #4641

Open
taylorb-syd opened this issue Sep 10, 2024 · 0 comments
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@taylorb-syd
Copy link

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

@taylorb-syd taylorb-syd added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

1 participant