indexzero / ps-tree

MIT License
149 stars 29 forks source link

TypeScript Definitions #22

Closed atrauzzi closed 6 years ago

atrauzzi commented 6 years ago

Would love to see official TS definitions included!

nelsonic commented 6 years ago

@atrauzzi will TypeScript definitions improve performance or reliability of the existing code? 🤔 If you are proposing the addition of a feature and want to make the code clearer that's different. But adopting a Type System just for the sake of it seems like adding complexity to this rather simple module.

atrauzzi commented 6 years ago

@nelsonic - I'm not sure I understand why you'd focus on the performance or reliability of the code in relation to this request. Typing information improves the reach of the code by allowing people who are using TypeScript to gain insights into the API.

Moreover, without typing information, people using strict checks in TypeScript will be given a compilation error upon use of this library because it is implicitly typed as any.

So -- I mean, if performance and reliability are the only two criteria by which you gauge the merit of anything, reliability would be it as typings improve static analysis of usages of this library.

Plenty of other libraries out there adding typing information and TS has some pretty decent reach these days. Would be super cool if this one did as well!

atrauzzi commented 6 years ago

Also note: You don't have to adopt a type system within your code. You simply need to provide a header file that annotates the public surface area (small) of this library.

nelsonic commented 6 years ago

@atrauzzi what I don't understand is why you would want to add a layer of complexity on top of such a simple module without a clear benefit to the millions of existing users.

If there was something specific about the existing JS code that was incomprehensible in it's current state I would support the idea of adding TS annotations. But you are proposing sprinkling glitter on something that is already working as expected. How are you using ps-tree in your code? Did you find the interface/API "too complex" to understand in it's current form?

nelsonic commented 6 years ago

I worry when people want to add layers of needless complexity to existing code just for the sake of following a trend.

atrauzzi commented 6 years ago

Wow.