DEV Community

Discussion on: Using Typescript without compilation

 
seanmay profile image
Sean May

Because there is literally 0 requirement to run tsc for any reason, whatsoever, from the standpoint of the author of the code...

You now have a necessary build step to catch the errors that the developer made in JSDoc, but you have to do it in a post dev process, if you aren't going to run a live recompilation step... and if you are going to run a live recompilation step, then you are just adding more headaches because you are inventing more ways of writing your type incorrectly, without being caught by the editor (and instead requiring debugging via the terminal, or debugging via a precommit hook, or via a PR process). You went through the whole trouble of setting up the whole buildchain (at least from dev to origin) but completely skipped out on the benefits of great type inference and advanced type algebra being vetted in real-time, with immediate dev feedback. So you are still doing 100% of the work but getting ~40% of the benefit, with the added danger of being confidently incorrect about your types, and the added frustration of getting your feedback in a different place than your text buffer, and you are even adding the extra timebomb of allowing untested JSDoc through, given that it doesn't need any part of the build step to function.

Thread Thread
 
jorenbroekema profile image
Joren Broekema

I am going to repeat this 3 times in the hopes that it lands, because people keep missing this despite the author emphasizing this point multiple times:

Real time type inference, editor feedback, Intellisense, is completely equivalent to using TS files.

Real time type inference, editor feedback, Intellisense, is completely equivalent to using TS files.

Real time type inference, editor feedback, Intellisense, is completely equivalent to using TS files.

There is no need to run TSC to see the type errors, in VSCode and Jetbrains editors, Typescript Language Server works with both TS files and JSDocs in JS files, in the EXACT same way, to provide this live feedback, all you need it to set allowJs and checkJs to true in your tsconfig for that to happen. There is 0 difference. ZERO. There is no need to run tsc --noEmit during dev to lint, because you get the feedback immediately in your editor just like you would if you were using TS files.

Thread Thread
 
thepassle profile image
Pascal Schilp

You run tsc as a linter.

Some comments have been hidden by the post's author - find out more