Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support finding a jsconfig.json with tsc -p . #41350

Open
5 tasks done
Raynos opened this issue Oct 31, 2020 · 3 comments
Open
5 tasks done

Support finding a jsconfig.json with tsc -p . #41350

Raynos opened this issue Oct 31, 2020 · 3 comments
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript

Comments

@Raynos
Copy link

Raynos commented Oct 31, 2020

Search Terms

jsconfig project

Suggestion

When I run tsc -p . on a JavaScript project with jsconfig.json and // @ts-check with JSDoc it complains about not finding a tsconfig.json

Currently I have to run tsc -p jsconfig.json --maxNodeModuleJsDepth 0 to check my JavaScript project.

~/projects/sync-wait-group on master*
$ tsc -p .
error TS5057: Cannot find a tsconfig.json file at the specified directory: '.'.

It tells me that tsconfig.json does not exist.

Adding detection for jsconfig.json and turning --maxNodeModuleJsDepth 0 on by default ( which we do for tsconfig.json but not jsconfig.json ) would be a good user experience improvmenent.

Use Cases

Being able to use the tsc cli on a JavaScript + JSDoc project.

Examples

tsc -p . will "just work" for a JavaScript project.

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.
@RyanCavanaugh RyanCavanaugh added Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript labels Nov 5, 2020
@nickmccurdy
Copy link
Contributor

This would be great for parity with VSCode's jsconfig.json support in JS projects.

@piotr-cz
Copy link

The tsconfig docs says

Ideally this should stay at 0 (the default), ...

However it seems that the deafault value is different in case of jsconfig.json

@luk82
Copy link

luk82 commented Feb 14, 2024

I use "include" in jsconfig.json and keep maxNodeModuleJsDepth at 0.

npx tsc --noEmit --allowJs -p jsconfig.json --maxNodeModuleJsDepth 0

jsconfig.json:
{ "compilerOptions": { "module": "CommonJS", "target": "ES6", "checkJs": true }, "include": ["src/**/*"] }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

5 participants