Skip to content

Support comments and other valid tsconfig.json features #1

@jfsiii

Description

@jfsiii

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. microsoft/TypeScript#5450)

I think the CLI should fail using valid config files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions