'How to update an older version of a type
I have a project that runs AngularJS 1.5.x, and it uses type declarations from DefinitelyTyped: @types/[email protected]
. This is the last 1.5.x version, and it was published 3 years ago. Since then, the package has moved on to version 1.6.x.
- See the DefinitelyTyped repo sources for angular: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/angular
The problem with 1.5.23 is its use of an any
indexer on IScope
, which has since been patched in version 1.6.27. But we can't exactly upgrade to 1.6.27, because we're not using angular 1.6.x — we're locked to 1.5.
My question is: what are my options for dealing with this?
- Does DefinitelyTyped have a mechanism for publishing an update for an older version of a library?
- Will it get picked up by the
@types
publisher and published to npm as1.5.24
?
Thanks
Solution 1:[1]
Looking at DefinitelyTyped's github page, there does seem to be a precedent for updating previous major versions of packages.
Many libraries have a large installed base of developers (including maintainers of other packages using that library as a dependency) who won't move right away to a new version that has breaking changes, because it might be months until a maintainer has time to rewrite code to adapt to the new version. In the meantime, users of old library versions still may want to update type declarations for older versions.
So I think you have the option of making an issue on DefinitelyTyped's github and ask them to make the change for you. Angular is a sufficiently important package that I would hope they would be responsive to that. And of course, you always have the option of submitting a PR to them yourself. There seems to be some instructions for handling differences in version, but I'm not familiar with the specifics in this case.
If a change does get picked up and merged, it would be 1.5.24 and work like any other update.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Tracy Moody |