JamieMason / JamieMason/ts-import-types-cli
Support comments and other valid tsconfig.json features
- Dominant language
- TypeScript
- Stars
- 42
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
I ran `ts-import-types-cli -p path/to/tsconfig.json -d` and it failed with
```
SyntaxError: /Users/jfsiii/work/kibana/x-pack/plugins/fleet/tsconfig.json: Unexpected token } in JSON at position 212
at parse ()
at Object.Module._extensions..json (internal/modules/cjs/loader.js:1106:22)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object. (/usr/local/lib/node_modules/ts-import-types-cli/dist/bin.js:45:5)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
ts-import-types-cli --project /Users/jfsiii/work/kibana/x-pack/plugins/fleet/tsconfig.json is not a tsconfig.json file
```
The config file had comments. Removing them fixed the error.
Comments are supported in tsconfig.json (e.g. https://github.com/microsoft/TypeScript/pull/5450)
I think the CLI should fail using valid config files.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the ts-import-types-cli project-loading path shown in the stack trace at dist/bin.js:45, using the reported command and tsconfig.json example with comments as the reproducer. Confirm that commented tsconfig.json files are accepted, then check behavior for other valid tsconfig.json features mentioned by the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100