typesync doesn't respect packages major and minor versions
See original GitHub issueFirs of all - thank you for this easy to use tool. It found even more typing that I’ve added initially by hand.
However I’ve noticed a problem.
While tool preserves “Semver ^
or ~
for a package” it looks like it doesn’t check actual package version.
For example for package.json
that has
"backbone": "1.1.2",
"bootstrap": "^3.3.7",
it added
"@types/backbone": "1.3.46",
"@types/bootstrap": "^4.3.0",
Which has correct range marker in version, but still installed incompatible types versions.
DT packages should match major and minor package versions of packages they are providing typings for, so it make sense to restrict @types
package to compatible semver minor version (or lower like in case of @types/react-dom
that doesn’t have all minor version and had a lot of 16.0.x
version until jumped to 16.8
)
Also preserving semver major.minor version will allow to call npm and see if package isn’t marked as deprecated (related to #24)
In case when there is no compatible versions, but higher versions available might be better ask (or provide CLI flag) to add them.
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (3 by maintainers)
I am using the
semver
module for these checks.https://github.com/jeffijoe/typesync/blob/f3da5037ea6142d91f4db47c22eaa0880f841d4d/src/type-syncer.ts#L168
If you disagree with the current behavior, feel free to submit a PR and I’ll be happy to take a look. 😄
I didn’t think about this as I always keep my packages updated. 😇
This is going to make things a bit more complicated, but I’ll look into it when I have some time to work on this.