I wouldn’t say that fixing a bug should require a major version bump.
I don’t remember where but Rust has a document that outlines the kinds of changes that are considered breaking. It explicitly states that fixing soundness bugs isn’t considered a breaking change even though it might require users to change their code.
The situation of TS is very different to what Rust does though. Rust has very well-defined sound typing; for every piece of correct code, there is parts of the documentation explaining why it is correct. TypeScript is very different, it's not sound at all and the compiler letting code pass through doesn't mean it's actually correct. Instead, TypeScript helps you by catching as many errors as possible - and with any new release, it might help you find more errors. However, many of these things aren't documented at all, so deciding what's a breaking change is much harder.
For example, take Record<number, string> and Record<0 | 1 | 2, string>. The latter expects a value with ALL three keys (and they're all required): 0, 1, and 2, while the keys in the former are optional (the empty object would work). Special casing like that complicates typing rules by a lot - but it just so turned out to help catch the most errors for the wide variety of code written that uses Record.
Creating a precise specification for such a system while still giving the opportunity to extend it is nearly impossible.
And so changing that Record interface in a way that breaks code relying on is absolutely a major version bump. Even if you can't create a spec for it, you could at least regression test it to catch breaking changes.
25
u/davidpdrsn Aug 21 '20
I wouldn’t say that fixing a bug should require a major version bump.
I don’t remember where but Rust has a document that outlines the kinds of changes that are considered breaking. It explicitly states that fixing soundness bugs isn’t considered a breaking change even though it might require users to change their code.
TS could have done something similar.