question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow javascript (or typescript) config file

See original GitHub issue

Suggestion

I suggest allowing a tsconfig.js or tsconfig.ts as an optional alternative to tsconfig.json.

Use Cases

What do you want to use this for? Primarily to add comments to the tsconfig file. What shortcomings exist with current approaches? JSON does not allow comments. You can’t even hack in comments by adding fake fields like "_explanationOfTypeRoots", as the build complains about unknown compiler options and stops.

Examples

Many tools and frameworks allow javascript config files. Jest, for example. jest --init produces a heavily commented config file, which is very useful for beginners.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:15
  • Comments:18 (2 by maintainers)

github_iconTop GitHub Comments

32reactions
CEbbinghauscommented, Aug 22, 2021

We are not accepting PRs to turn config into an executable thing. This opens up an enormous can of worms (is it safe to run this? what dependencies does the config file have? what does the config file assume about its environment?) that we’d prefer remain closed.

This makes little sense to me when so many other JS libraries support them.

#39441 names a few but there are plenty more that all allow this behaviour. If every one of them had a discussion on the same security concerns, then wouldn’t looking through their discussions yield the information needed to implement it in a safe and responsible fashion?

21reactions
alexmiddeleercommented, Mar 14, 2019

Oh, nice! I was under the impression that comments were not allowed in JSON, but it makes sense that someone would write a parser that allows them. Thank you for your response, I am closing the issue because I no longer think this feature is necessary.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TSConfig Reference - Docs on every TSConfig option
A TSConfig file in a directory indicates that the directory is the root of a TypeScript or JavaScript project... Compiler Options. Top Level....
Read more >
Working with JavaScript in Visual Studio Code
It is possible to have mixed TypeScript and JavaScript projects. To start migrating to TypeScript, rename your jsconfig.json file to tsconfig.json and set...
Read more >
how to load a js config file in a typescript npm package that ...
create a config.js file with export default 'hello world' · type npx someLibrary and see "hello world" in the terminal.
Read more >
TypeScript configuration - Angular
It is a superset of JavaScript with design-time support for type safety and ... A given Angular workspace contains several TypeScript configuration files....
Read more >
How to Add TypeScript to a JavaScript Project - freeCodeCamp
Typescript config file · We read all the files in the src or test or config directory (using the include flag). · We...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found