7 ms·
how can you compile it if javascript is a valid subset of typescript? confused.
by xiaodai 2mo ago
how can you compile it if javascript is a valid subset of typescript? confused.
- panzi 2mo agoEither it is only accepting a subset of TypeScript, or it is still interpreting the parts that don't have enough types. Given other comments here it sounds like the later.
- queenkjuul 2mo agoBoth, basically. Default is the subset, but you can enable an interpreter
- lpribis 2mo agoNo idea about this project, but it is very possible to compile a dynamically typed language, without large VM/runtime. See Common Lisp, Julia
- panzi 2mo agoYes, and JavaScript itself is JITed. I used interpreted here as a shorthand for interpreted and/or JIT compiled at runtime.
- CarpeNecopinus 2mo agoWhat it can actually compile is a subset of well-behaved typescript. For anything else it bails out and asks you to ship a JS engine (albeit, not NodeJS) again.