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 for programmatically using #30751

Closed
dagadbm opened this issue Apr 4, 2019 · 5 comments
Closed

Support for programmatically using #30751

dagadbm opened this issue Apr 4, 2019 · 5 comments

Comments

@dagadbm
Copy link

dagadbm commented Apr 4, 2019

Search Terms

tsconfig js tsconfig programatically

Suggestion

I would like for TypeScript to add suport for tsconfig.js instead of tsconfig.json (similar to what babel/jest/prettier have.

Use Cases

I have some alias.js file which contains an object with all of my aliases which I then import on 3 different places: babel.config.js , webpack.config.dev.js, webpack.config.prod.js. (In case it is not obvious, this is a CRA ejected project).
I then want to be able to use VSCode navigation capabilities but I cannot because he does not find the aliases. After some research I believe you could create a tsconfig.json which VSCode would then look for the paths there and make path resolution work (plus vs-code would not complaint about unresolved module errors from eslint).

If I was able to do a tsconfig.js file I would be able to fix this and vscode would then just read from that file automatically.

Checklist

My suggestion meets these guidelines:

  • [ X ] This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • [ X ] This wouldn't change the runtime behavior of existing JavaScript code
  • [ X ] This could be implemented without emitting different JS based on the types of the expressions
  • [ X ] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • [ X ] This feature would agree with the rest of TypeScript's Design Goals.
@MartinJohns
Copy link
Contributor

MartinJohns commented Apr 4, 2019

Duplicate of #30400. Search terms used: is:issue tsconfig.js - second issue.

@dagadbm
Copy link
Author

dagadbm commented Apr 4, 2019

same idea. different use case (im not talking about adding comments but actual code execution).
Is this a very complex thing to do?

@MartinJohns
Copy link
Contributor

same idea.

Same suggestion, yes, just with a different intention.

Is this a very complex thing to do?

The TypeScript team deemed it as too complex. The different intention of your proposal does no change the complexity.

Here's another issue that requested the same: #25271

@dagadbm
Copy link
Author

dagadbm commented Apr 5, 2019

alright. there is a fair point there indeed regarding not all tools being able to read a js instead of a json for configuration. thanks Martin. I will close this issue.
Funny how I could not find it after searching, my issue search foo is still very young.

@dagadbm dagadbm closed this as completed Apr 5, 2019
@c-vetter
Copy link

For anybody still interested in this feature: https://www.npmjs.com/package/tsconfig.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants