Hacker News new | ask | show | jobs
by mcphage 2687 days ago
I generally like Typescript, but I find it frustrating that it doesn't include a useful standard library. Instead, we're stuck with Javascript's bare bones of a library, which means a lot of thing that can be done in other languages just using their library, need to either code from scratch, or import from a 3rd party library.
1 comments

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. :)

> 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 :-)