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

Typescript can't find dompurify type definition file when the package manager used is yarn #6078

Closed
Phebonacci opened this issue Nov 25, 2024 · 0 comments · Fixed by #6079
Closed
Labels
Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect

Comments

@Phebonacci
Copy link

Phebonacci commented Nov 25, 2024

Description

When I install my nextra project's dependencies and run tsc to check for any type errors, I get the ff error message from typescript:

error TS2688: Cannot find type definition file for 'dompurify'.
The file is in the program because:
Entry point for implicity type library 'dompurify'

I found out that this is caused by a conflict between mermaid's dompurify and @types/dompurify dependencies. What's happening is mermaid's @types/dompurify dependency at version ^3.0.5 resolves to version 3.2.0, which then depends on dompurify version 3.2.1. Somehow, this causes the aforementioned typescript error.

To clear things up, my project doesn't directly depend on dompurify but @theguild/remark-mermaid does which, in turn, is dependend upon by nextra.

Steps to reproduce

  1. Clone the repro repo: https://github.com/Phebonacci/sample-nextra
  2. Install the dependencies via yarn install. You should see a warning from dompurify as below:
image
  1. Run yarn type:check. You should see the error mentioned in the Description and shown on the screenshot attached under Screenshots.

Screenshots

image

Code Sample

No response

Setup

  • Mermaid version: 11.4.0
  • Browser and Version: [Chrome, Edge, Firefox]

Suggested Solutions

  • If possible, upgrade dompurify to the latest version (3.2.x) and remove @types/dompurify.
  • If upgrading dompurify is not possible, pin the major and minor versions of @types/dompurify to 3.0.

Additional Context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant