question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

typesync doesn't respect packages major and minor versions

See original GitHub issue

Firs 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:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jeffijoecommented, Mar 18, 2019

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. 😄

1reaction
jeffijoecommented, Mar 5, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Special handling for npm `@types` · Issue #519 · renovatebot ...
TypeScript's definition packages are always named @types/xxx (published by official BOT), and its version are same as target package's MAJOR.MINOR version.
Read more >
NPM caret doesn't bring in newest minor version
This is the case with 0.x.x since a leading zero indicates that the package isn't into a "stable" version yet. Until your package...
Read more >
How to Use Semantic Versioning in NPM | heynode.com
In this tutorial we learned that Semantic Versioning dictates how a packages version number is incremented by following the MAJOR.MINOR.PATCH format. We learned ......
Read more >
Semver explained - why is there a caret (^) in my package.json?
Semver uses three-part version number like 3.9.2 and calls these three numbers from left to right as the major, minor and patch numbers....
Read more >
Suitcase Fusion User Guide - Extensis
The toolbar provides access to important functionality, including font activation, creating new font groupings, editing font attributes, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found