6 ms·
The flagship feature of TS is static typing. That will never exist in JS.
by recursive 10y ago
The flagship feature of TS is static typing. That will never exist in JS.
- Lio 10y agoI'd never say never. As I'm sure you're aware, JavaScript has had statically typed arrays since WebGL was introduced. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays https://developer.mozilla.org/en-US/docs/Web/JavaScript/Type...
- WorldMaker 10y agoES4 the version of JavaScript that time mostly forgot (except for Adobe and ActionScript) had static types that looked rather similar to Typescript/Flow. It's not impossible that it will be revisited. Especially now with the precedent from Python of defining/standardizing no runtime behavior for it, only syntax acceptance; that seems like something browsers might be more okay with versus the runtime behaviors required/encouraged by ES4.
- recursive 10y agoIt has typed arrays, but they're still not statically typed. In a statically typed language, this would not run. console.log("hello"); typedArr[0] = incompatibleType(); In javascript, it will produce "hello" as output, and then a run-time failure.
- goatlover 10y agoThey got class stuff into the language, and that was no small feat (very contentious issue), even if it is still syntactic sugar over prototypes.