`tsconfig.json` with `allowJs: true` does not downlevel JS
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 9.8k
- Forks
- 326
- PR merge metrics
- No merged PRs in 30d
Description
I have the following tsconfig.json in a mixed project (js/ts):
{
"compilerOptions": {
"target": "es2019",
"module": "commonjs",
"moduleResolution": "node",
"allowJs": true,
"esModuleInterop": true,
"strict": true,
"outDir": "dist",
"skipLibCheck": true,
"sourceMap": true
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
}
It seems like the ts transpiler is only being applied to the typescript files and the js files are taking a different path.
I only assume this because I have optional chaining in both the js and ts files and only the ts files get the proper conversion from ?. operation to chained null checks.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the tsconfig.json options and trace how allowJs, target, and optional chaining are handled for the mixed JS/TS input described in the issue. Compare the JavaScript and TypeScript transpilation paths; done means JavaScript optional chaining is downleveled consistently with TypeScript when targeting es2019.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100