typesync icon indicating copy to clipboard operation
typesync copied to clipboard

Use same major/minor version with corresponding package

Open munierujp opened this issue 3 years ago • 0 comments

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 avatar Apr 02 '22 00:04 munierujp