Hacker News new | ask | show | jobs
by lstamour 2689 days ago
Don’t overlook the number of options available out of the box with the —lib parameter: https://www.typescriptlang.org/docs/handbook/compiler-option...

In many ways, I prefer this approach—it means TypeScript as a language will stay compatible with JavaScript, and keeps options like Babel 7’s outright removal of TS types easily done. If you need a feature JS doesn’t have, import it, or pick a browser or runtime API. Seems simple enough to me. :)

1 comments

> Don’t overlook the number of options available out of the box with the —lib parameter

Thanks! I honestly wasn't aware of that at all!

> it means TypeScript as a language will stay compatible with JavaScript

If Typescript's library was written in JS, then the elements that were needed can be compiled down and included with your code.

> If you need a feature JS doesn’t have, import it, or pick a browser or runtime API

I really appreciate standardization—that way everyone is on the same page with basic methods. I don't have to worry about learning multiple versions, or worry that code I'm reading is doing the same thing in a slightly incompatible way. Or listen to people arguing about those same minor differences :-)