Open PIMBA opened 3 years ago
This would be a big help for me. For instance, I'm currently on TS 3.7. Instead of jumping to the latest TS atomically, I'd like to run the tsIgnore
plugin separately for each incremental TS release. That way, when my team is removing the expect-error
s, we know which TS release introduced the error.
I can see the use case here, though it does present some challenges in maintaining this project. I don't plan to work on this, but I'll jot down some thoughts which may spur further conversation and give an idea of what I think a proposal and implementation would need to address.
We could ensure that we always use the project's TypeScript version by specifying typescript
as a peer dependency rather than a normal dependency, and specifying a range of compatible versions. I think this would work, but a couple things to note:
npm install -g
or yarn global add
). I think this is probably fine, but worth acknowledging.Being able to work with a project's TypeScript version means that ts-migrate has to stay compatible with multiple versions of TypeScript. I think we'd need to define:
That last point is the trickiest, since TypeScript's APIs can change in incompatible ways between versions. For example, TypeScript 4.0 introduced a new node factory API, which ts-migrate uses. The old API is deprecated and slated to be removed in TypeScript 4.3. In order to stay compatible with versions earlier than 4.0 and later than 4.2, we'd have to maintain our own abstraction around both APIs.
Our project is using typescript@4.0.x, but latest ts-migrate is using typescript@4.1.2. So is there any way to running ts-migrate at typescipt 4.0.x ?