checkJs: allow file extensions other than .js
See original GitHub issueFirst of all, this option is super exciting! Thank you so much for the TypeScript team to make such an incredible tool ❤️
Surprisingly enough, this week I wanted to have type check in a *.jsfl
file (Scripting for Adobe Animate) and it worked pretty well using Facebook’s Flow. They have an option to configure a different file format other than .js
.
It would be nice to allow this sort of configuration for TypeScript as well. I’ve naively tried to use "include":["./src/*.jsfl"]
but it didn’t worked. 😅
Or is there a hidden option for this? Thanks!
Issue Analytics
- State:
- Created 6 years ago
- Reactions:12
- Comments:14 (3 by maintainers)
Top Results From Across the Web
How can I get file extensions with JavaScript? - Stack Overflow
This is another non-regex solution that I think is more efficient: return filename.substring(filename.lastIndexOf('.')+1, filename.
Read more >TSConfig Reference - Docs on every TSConfig option
The value of extends is a string which contains a path to another configuration file to inherit from. The path may use Node.js...
Read more >Working with JavaScript in Visual Studio Code
To enable type checking for all JavaScript files without changing any code, just add "js/ts.implicitProjectConfig.checkJs": true to your workspace or user ...
Read more >JavaScript modules - MDN Web Docs
This guide gives you all you need to get started with JavaScript module ... we've used .js extensions for our module files, but...
Read more >File Upload - HackTricks
Add another layer of extensions to the previous check: ... files is inside a whitelist to assure that only allowed files are going...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I did a little experiment a while back where I carefully modified TypeScript’s source to add support for
.mjs
. I did this in a few hours and that included getting all the tests running.I honestly had assumed from the push back that it is not that simple, but then I found that it is.
It became clear from further interactions that while it can be done, it cannot be supported in a way that meets the quality expectations from TypeScript.
If my PR would have been accepted, could my implementation have broken existing projects? In my opinion, that is the only problem that I completely considered beyond my scope as an external contributor.
Once again, imho, as a user not interested in or not expecting this new behaviour, all I expect from TypeScript is to lock it behind a flag so that only those who opt in and understand and accept the ramifications of “experimental support for other extensions” are affected by it. The other guy still wants it and the fact that it is not being addressed by TypeScript on par with the implications of the issue are extremely disappointing.
https://github.com/Microsoft/TypeScript/pull/23678
The
checkJs
andallowJs
merely adds complexity to the compiler, the simple solution would be to allow users to configure what files need be treat as TypeScript.