Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use same major/minor version with corresponding package #86

Closed
munierujp opened this issue Apr 2, 2022 · 4 comments · Fixed by #105
Closed

Use same major/minor version with corresponding package #86

munierujp opened this issue Apr 2, 2022 · 4 comments · Fixed by #105

Comments

@munierujp
Copy link

munierujp commented Apr 2, 2022

Why

Because 10.12 is at the end of the first line, the npm version of the @types/node package will also be 10.12.x. Note that the first-line comment in the index.d.ts file should only contain the major.minor version (e.g. 10.12) and should not contain a patch version (e.g. 10.12.4). This is because only the major and minor release numbers are aligned between library packages and type declaration packages. The patch release number of the type declaration package (e.g. .0 in 10.12.0) is initialized to zero by Definitely Typed and is incremented each time a new @types/node package is published to npm for the same major/minor version of the corresponding library.

https://github.com/DefinitelyTyped/DefinitelyTyped#how-do-definitely-typed-package-versions-relate-to-versions-of-the-corresponding-library

Example

current package.json:

{
  "dependencies": {
    "node-fetch": "^2.5.0"
  }

expected package.json after npx typesync:

{
  "dependencies": {
    "node-fetch": "^2.5.0"
  },
  "devDependencies": {
    "@types/node-fetch": "^2.5.12"
  }

actual package.json after npx typesync:

{
  "dependencies": {
    "node-fetch": "^2.5.0"
  },
  "devDependencies": {
    "@types/node-fetch": "^2.6.1"
  }
@munierujp munierujp changed the title Use same major/minor version with target packages Use same major/minor version with corresponding packages Apr 2, 2022
@munierujp munierujp changed the title Use same major/minor version with corresponding packages Use same major/minor version with corresponding package Apr 2, 2022
@jeffijoe
Copy link
Owner

TypeSync should already attempt to install the most compatible version, is this still an issue?

@Chaxwell
Copy link

I have this

{
  "dependencies": {
    "react-dom": "^16.14.0"
  }
}

and it gave me this

{
  "devDependencies": {
    "@types/react-dom": "^18.2.18"
  }
}

while there is a 16.9.8 version that would be a lot closer I guess ?

@jeffijoe
Copy link
Owner

Thank you everyone for your reproduction cases! I think I found the issue, working on a fix for this.

@jeffijoe
Copy link
Owner

I've released [email protected] to address this, please give it a try.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants