4 ms·
You don't need a compiler. The vanilla `node` binary works fine with a few trivial syntactic changes. It sucks that your compiler's slow! Check out `swc` if yo
by a_wild_dandan 3y ago
You don't need a compiler. The vanilla `node` binary works fine with a few trivial syntactic changes.
It sucks that your compiler's slow! Check out `swc` if you prefer speedy compilation.
- arp242 3y agoswc doesn't do type checking, so while useful in some cases it's not really a replacement for tsc.
- tom_ 3y agoDoes node do static type checking?
- a_wild_dandan 3y agoNope! `node` is just a binary that executes JS code (e.g. the above code, mod a few syntax choice tweaks). Since JS has no static types, `node` has no types to check. Other languages can be compiled (perhaps "transpiled") to JS, some of which have static type mechanisms. One of those other languages, TypeScript, has static types. There are tools to compile TypeScript into JS: `swc`, `tsc`, etc. There are also tools to statically type check TypeScript (`deno`, `tsc`, etc). Personally, I use `swc` for speedy TS compilation. I use my IDE's `tsc` language server for the separate job of highlighting type issues. But everyone has their preferred workflow!