stupid question: why doesnt google chrome support native typescript execution on their chromium engine?
Analemma_•20m ago
I'm not enough of an expert in PL theory and compilers to say for sure, but I suspect that because Typescript's syntax and semantics are all designed with total type erasure in mind, there's no advantage you could get to executing it natively versus compiling to JavaScript and taking advantage of all the optimizations JS engines already have.
Different projects use different versions of typescript with different configurations, and almost no one wants the client to throw type errors where the untyped code would have actually worked. I.e. the are drawbacks but no advantages.
This is ongoing standardisation work to allow it to _ignore_ typescript and just run the JavaScript which will be nice but not a huge win.
paxys•9m ago
"Native typescript execution" can mean two different things:
1. Chrome/v8 takes TS code, compiles it down to JS internally, and then runs it like normal. This isn't going to be too hard to do, but also isn't going to be very meaningful. Compiling is a one-stop process in any case, and plenty of tooling exists to make it seamless.
2. Chrome/v8 actually understands types at runtime, and throws exceptions for mismatches. This isn't going to be possible without a major rewrite of the v8 engine and the ECMAScript spec itself.
And a big challenge for both of these is that TypeScript is iterating at too fast a pace for something like Chrome to keep up. It's best to just leave versioning and compilation for the developer to manage and give end users a consistent JavaScript experience.
xiaomai•37m ago
is anyone using the preview releases in neovim yet?
vivzkestrel•43m ago
Analemma_•20m ago
benbayard•18m ago
ZiiS•17m ago
paxys•9m ago
1. Chrome/v8 takes TS code, compiles it down to JS internally, and then runs it like normal. This isn't going to be too hard to do, but also isn't going to be very meaningful. Compiling is a one-stop process in any case, and plenty of tooling exists to make it seamless.
2. Chrome/v8 actually understands types at runtime, and throws exceptions for mismatches. This isn't going to be possible without a major rewrite of the v8 engine and the ECMAScript spec itself.
And a big challenge for both of these is that TypeScript is iterating at too fast a pace for something like Chrome to keep up. It's best to just leave versioning and compilation for the developer to manage and give end users a consistent JavaScript experience.