by Arnavion · 4y ago · 0 comments
Run something like this for low latency development. Edit, save, see results, repeat.
In parallel, run the TypeScript compiler to eventually display type errors, inform your IDE with what it needs to deliver great completion, etc.
if things like swc does not exist then deno would have to use tsc, which is slower and contradict with being a replacement to nodejs, which is what tsc runs on
That said, I can understand one would want to use TypeScript and this in parallel, I just caution those going down this road that it is very easy to find yourself not really using TypeScript, and the second your TS doesn't compile with the official TS compiler, you are going to have upset users - and they might even be yourself! I for example quite liked ESBuild until I found situations where it didn't work, and then all those "instant" compiles were forgotten because I had to dig through esoteric, outside-of-my-expertise error messages and issues. Quick, type-safe hot reloading should be the target of course, but giving up type safety for speed is really not a good tradeoff.
In other words, instead of `tsc` you run `tsc --noEmit && swc`
You still need to know about the actual types in the program, and you still need to run them through `tsc` first regardless of whether `swc` accepts them or not.
no, have you ever done hot reload in front-end development? When you make a typo on a type definition do you want tsc to bail & the whole application state to be lost? I guess CPU cycles are more valuable than your time?
edit: btw tcs does NOT bail, so your argument is moot because the typescript compiler itself "wastes cycles" like that.
> weakening your type safety
nothing is "weakened" here, what happens is, people can continue to work/test different parts of the codebase without having the full project type-checked out.
Nowhere in my comment did I say that.