-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Javascript tsconfig file (tsconfig.js) #39441
Comments
Duplicate of #30400. Used search terms: |
#30400 should have been marked a duplicate of this one. This issue does a much better job of explaining why we need this feature. one tsconfig.json simply doesn't cut it for more complicated projects. |
Why was this issue closed? This is a fantastic suggestion. I'm looking to dynamically set |
Up. Having all the setup json as js files is the future already happening. |
@qodesmith actually it's not impossible, it's very easy 👍
I was looking if |
@faeb187 That would not work if your config includes non encodable content, like functions, which would be the use case for a |
@Tofandel What @faeb187 is suggesting is manipulating JSON data by reading, updating, and re-writing the data back to disk. Since the source of truth would be a JSON file, there wouldn't be any non-encodable content. It's essentially the same solution I came up with a while ago, but it's still a hack. |
Search Terms
config
tsconfig.json
Suggestion
It would be very helpful if typescript followed the conventions of pretty much every other JS-stack tool and allowed the configuration to be done as a javascript file so they can more easily be manipulated.
For example all these tools (and many more) already accept configuration files to be javascript:
Prettier -> .prettierrc.js
Jest -> jest.config.js
Webpack -> webpack.config.js
eslint -> .eslintrc.js
styleling -> .stylelintrc.js
lint-staged -> lint-staged.config.js
My suggestion is for typescript tsconfig resolver to look for a
tsconfig.js
file if available, if sorequire()
it and use the exported values as configuration. If that file is not available then follow the current resolver rules for tsconfig.json.Use Cases
Examples
Right now it is impossible to merge arrays when using the "extends" option of tsconfig.json. If the configuration were javascript files this would be feasible:
Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: