Use same major/minor version with corresponding package
munierujp opened this issue · 4 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.
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"
}
TypeSync should already attempt to install the most compatible version, is this still an issue?
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 ?
Thank you everyone for your reproduction cases! I think I found the issue, working on a fix for this.
I've released typesync@0.12.0
to address this, please give it a try.