Skip to content

Clarify documentation on tsconfig usage #2062

Closed
@slhck

Description

@slhck

Per #168 I understand that tsconfig.json is not read by default. This was confusing to me, as I have a project where building schemas failed due to this error:

➜ npx ts-json-schema-generator --path src/types/config.ts --type Config
error TSJ - 108: Type check error

  /Users/werner/Documents/Projects/test/node_modules/@types/selenium-webdriver/bidi/captureScreenshotParameters.d.ts:9:5
    9     #map: Map<string, any>;
          ~~~~
    Private identifiers are only available when targeting ECMAScript 2015 and higher.

Yet in my tsconfig.json I have specified ES2023 as a target.

I only then realized that I needed to explicitly pass the tsconfig.json file to the command to make it work. Just from the CLI args I would have assumed that "Custom tsconfig.json path" means: "Any config other than tsconfig.json".

Is that behavior intentional? (One would assume that proper type compilation also requires knowing about the project's build target, but maybe this is not as big of a problem as I think it is for most users.)

It would be great if the documentation could be updated to reflect that aspect. Maybe I'm the first one to get bitten by this, but from a quick review I haven't found similar issues. Let me know how you think this could be best addressed and I can provide a PR!

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions