ts-import-types-cli icon indicating copy to clipboard operation
ts-import-types-cli copied to clipboard

Support comments and other valid tsconfig.json features

Open jfsiii opened this issue 3 years ago • 0 comments

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 (<anonymous>)
    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.<anonymous> (/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.

jfsiii avatar Mar 03 '21 15:03 jfsiii