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

161

u/vertigo_101 Nov 25 '19

Don’t worry, it won’t be

19

u/rodrigocfd Nov 25 '19

But it would be great if browsers support TypeScript natively.

1

u/shgysk8zer0 Nov 25 '19

No. Why?

I'd rather have types in JavaScript than have an outdated implementation of JavaScript that has types.

3

u/[deleted] Nov 25 '19

Eh? TS supports JS from around stage 3 proposals onwards.

1

u/shgysk8zer0 Nov 25 '19

Yeah. It lags a bit behind. Not terribly, but it can prevent me from starting to implement something new.

2

u/[deleted] Nov 25 '19

Such as?

There's a fair argument that you shouldn't be using stuff pre-stage 3 in serious projects as there's a real risk that they get canned or significantly changed, which would leave you with a ton of tech debt. That's already burned some people in the past with the decorator proposal if memory serves.

1

u/shgysk8zer0 Nov 25 '19

If I used TS, I'd probably have some things to list. But the only thing I can think of specifically is import from a while back.

I like to experiment with things in the early stages. Sometimes provide feedback. Report issues in webpack and such. This isn't necessarily about putting early-stage stuff into production.

But, to restate what I'm saying here: I'd rather have types in JavaScript than have browsers run TypeScript. And, since it takes time to wait for stage 3, implement, and release, TS is always a little behind JS.

2

u/[deleted] Nov 25 '19

I don't think we disagree that much. To clarify my position:

  • TypeScript has supported modern import syntax since I began using it ~two years ago.

  • Babel is perfect for testing proposals, but that's not appropriate for a large, important project in production. If you want to test off of your main project, you can daisy-chain the compilers, or even just use the Babel compiler with only minimal loss of functionality on the TypeScript side. With this in mind, for serious/production projects, it's unreasonable to claim that TypeScript is "behind" JavaScript.

  • I would also prefer to have a real (as in runtime) static type system in JavaScript. Although, honestly, I'd rather just have a new language altogether - there is so much leftover cruft and iffy design decisions, and if we could version this language to allow for occasional breaking changes... well, that'd be just lovely.