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

Avoid installing deprecated type packages #114

Closed
silverwind opened this issue Jul 2, 2024 · 3 comments · Fixed by #115
Closed

Avoid installing deprecated type packages #114

silverwind opened this issue Jul 2, 2024 · 3 comments · Fixed by #115

Comments

@silverwind
Copy link

silverwind commented Jul 2, 2024

According to #79, deprecated type packages should not be suggested or installed, but I notice it still does, for example with this package.json:

{
  "devDependencies": {
    "escape-goat": "4.0.0",
    "escape-string-regexp": "5.0.0"
  }
}
$ npx typesync --dry
»  TypeSync v0.12.1
»  —— DRY RUN — will not modify file ——
✔  2 new typings can be added.

📦 test — package.json (2 new typings added)
├─ + @types/escape-string-regexp
└─ + @types/escape-goat

✨  Run typesync again without the --dry flag to update your package.json.

Both type packages are deprecated as seen during npm install:

npm warn deprecated @types/[email protected]: This is a stub types definition. escape-goat provides its own type definitions, so you do not need this installed.
npm warn deprecated @types/[email protected]: This is a stub types definition. escape-string-regexp provides its own type definitions, so you do not need this installed.
@silverwind silverwind changed the title Avoid installing deprecated packages Avoid installing deprecated type packages Jul 2, 2024
@jeffijoe
Copy link
Owner

jeffijoe commented Jul 2, 2024

I think I know what the issue is. When there's no matching version of the typings package, it'll fall back to checking the first one in the list of versions. The code assumes that to be the latest version, but NPM seems to be returning them in the other order.

EDIT: Nevermind, here we're sorting them first.

EDIT 2: Looks like the API no longer returns the deprecated top-level field in the JSON. Will have to check in the package version itself.

@jeffijoe
Copy link
Owner

jeffijoe commented Jul 2, 2024

Fixed in v0.12.2. Thanks for reporting!

@silverwind
Copy link
Author

Thanks, working with 0.12.2!

$ npx [email protected] --dry
»  TypeSync v0.12.2
»  —— DRY RUN — will not modify file ——
✔  No new typings to add, looks like you're all synced up!

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.

2 participants