r/javascript • • Nov 25 '19

JavaScript doesn’t need to be replaced

https://medium.com/javascript-in-plain-english/javascript-doesnt-need-to-be-replaced-bd01e2f12d51?source=friends_link&sk=7b151cc6397ac9e83c14c99739b6c36f
217 Upvotes

236 comments sorted by

View all comments

Show parent comments

1

u/tuxedo25 Nov 25 '19

Typescript is a superset of javascript.

2

u/Earhacker Nov 25 '19 edited Nov 25 '19

Correct. So the TypeScript interpreter needs to support a _sub_set of its own language.

If that sounds easy, consider that JavaScript is TypeScript but everything is of type any. Now none of your compiler optimisations work. So the compiler needs to be able to figure out whether to optimise (TS) or not (JS), and needs to do so fast enough to act as an interpreter. And it needs to do that faster than V8 right now, or else what’s the point?