better-typescript-lib icon indicating copy to clipboard operation
better-typescript-lib copied to clipboard

How is this different from ts-reset?

Open EvgenyOrekhov opened this issue 1 year ago • 3 comments
trafficstars

I was wondering if I should use better-typescript-lib or https://github.com/total-typescript/ts-reset, or both.

Would be great to have a comparison in the README.

EvgenyOrekhov avatar Jun 12 '24 17:06 EvgenyOrekhov

See #29 for an article that compares both libraries. IMO README is not the ideal place to do so as one may find it provocative.

graphemecluster avatar Jun 12 '24 21:06 graphemecluster

Thanks for the link. Although, the article doesn't explain much in terms of concrete cases and examples. I understand that there's tons of changes to the core types, but it would be good to have more examples than just JSON.parse() and fetch().json().

EvgenyOrekhov avatar Jun 13 '24 00:06 EvgenyOrekhov

Hello, thank you for your interest!

While you can check the diffs to grasp the changes made to TypeScript's built-in type definitions, it is definitely good to have more concrete examples.

Basically better-typescript-lib aims to fix all definitions that are subpar, including ones that return any. I believe better-typescript-lib covers almost all cases that ts-reset provides fixes for.

Also there is architectual difference; better-typescript-lib actually replaces built-in type definitions while ts-reset only provides additional overloads. In general, the former approach is silgithly safer.

That said, on which to choose:

  • If you like opinionated, all-in-one solution, use better-typescript-lib.
  • If you want to get deeper understanding of each fix and choose which ones to apply to your project, use ts-reset.
  • It doesn't make sense to use both at the same time.

uhyo avatar Jun 13 '24 10:06 uhyo