jeffijoe / typesync

Install missing TypeScript typings for dependencies in your package.json.
MIT License
1.51k stars 21 forks source link

Typesync adding old alpha versions of types. #45

Closed ghost closed 4 years ago

ghost commented 4 years ago

For instance, when I had a dependency of "bcrypt": "^3.0.7" - it gave me "@types/bcrypt": "^10.0.28-alpha" which is 3 years old. The latest version of @types/bcrypt is actually 3.0.0.

jeffijoe commented 4 years ago

TypeSync will use semver to find the closest matching version.

jeffijoe commented 4 years ago

Closing due to inactivity.

genesiscz commented 3 years ago

same happens with react-scroll

having

    "react-scroll": "^1.8.1",

gives me

"@types/react-scroll": "^3.0.27",

which was an alpha version from 2016. Took 5 hours of my life to figure it out because I was getting very weird errors having anything but pointing me in the right direction.

image

After correcting the version all works properly.

eithermonad commented 3 years ago

@genesiscz

I believe the reason for the issue is because the maintainers of the types for react-scroll neglected to mark the version you specified - 3.0.27 - with the -alpha suffix. Typesync thus sees 3.0.27 to be the best matching types version for the code package version you have installed. This is a consistency error on the part of the maintainers of the types package when it comes to publishing.

genesiscz commented 3 years ago

Yea, I know why it happened, it is a dumb inconsistency error, the point is typesync shouldn't probably match versions two major lvl higher than it is stated in the package.json. 1.8.1 -> 2.0 is wrong, 1.8.1 -> 3.0.27 is even more wrong. Wouldn't it be a better idea to just skip these? It could save a lot of time for future visitors :-)

Anyway thanks a lot for this one, it could have saved me a lot of time! :)