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

depedency @iconify/tools v3 comes with incorrect types for cheerio (fixed in v4) #210

Open
aripalo opened this issue Mar 5, 2024 · 1 comment

Comments

@aripalo
Copy link

aripalo commented Mar 5, 2024

What version of astro-icon are you using?

v1.1.0

Astro Info

Astro                    v4.4.11
Node                     v20.11.1
System                   macOS (arm64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             @astrojs/mdx
                         astro-icon

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

Not directly a bug in astro-icon, but a bug that has been fixed in astro-icon's depedencies.

@iconify/tools had an issue (that is fixed now) where it installed @type/cheerio package even though cheerio@1.0.0-rc.12 (which it uses) comes with its own (correct) type definitions.

You can see the transitive dependency of @types/cheerio in astro-icon's pnpm-lock.yaml.

When using cheerio@1.0.0-rc.12 in one's own codebase, this can lead to type errors as TypeScript is incorrectly resolving the types from @types/cheerio (and not the cheerio package itself).

I acknowledge that the fix would require a major version bump for @iconify/tools from v3 to v4, so this might require more work than just version bump, but I still feel this is an issue worth mentioning (and creating an issue for).

What's the expected result?

We'll I'd like astro-icon to bump up its depedency of @iconify/tools from v3 to v4, so that one wouldn't have to deal with the incorrect @types/cheerio.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-8hrtln?file=src%2Fdemo.ts

@aripalo aripalo changed the title @iconify/tools depedency @iconify/tools v3 comes with incorrect types for cheerio (fixed in v4) Mar 5, 2024
@aripalo
Copy link
Author

aripalo commented Mar 5, 2024

In case someone else has this problem, one hacky-workaround could be configuring this into package.json:

"overrides": {
  "@iconify/tools": {
    "@types/cheerio": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.12.tgz"
    }
 },

Package.json overrides allow to override the version of any dependency, but as npm accepts tgz url as version, I'm pointing it to the cheerio package instead.

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

No branches or pull requests

1 participant