Will be any version of TypeScript Obsolete?

241 views Asked by At

I have a question: In the future, will any version of TypeScript be deprecated? I mean, if I'm using TypeScript 3.8 for some components, should I upgrade this components to TypeScript 4.x? or maybe we can keep these componentes without changes. There are some restrictions of obsolescence that we have to adhere to, hence my question.

1

There are 1 answers

1
Etheryte On

The term you're looking for is breaking changes, and breaking changes happen nearly every release. As an example, here's the breaking changes for the latest three releases:

If your components use those specific features in a way that isn't valid in a newer Typescript version, you'll get a compilation error when trying to compile your project using that newer version.

In my very subjective opinion, most of the time breaking changes fill in missing gaps in the language that were good to avoid to begin with. For example, the breaking change for object rests over generics in 4.6:

class Thing {
  someProperty = 42;
  someMethod() {
    // ...
  }
}
function foo<T extends Thing>(x: T) {
  let { someProperty, ...rest } = x;
  // Compiled successfully in Typescript 4.5, throws an error in Typescript 4.6 with: Property 'someMethod' does not exist on type 'Omit<T, "someProperty" | "someMethod">'.
  rest.someMethod();
}

The breaking change in this context could be looked at as a bugfix for the language, but it will require action from you to fix if you had code like this and then needed to target a newer version of Typescript.