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

Cannot find type definition file for '@types/react-dark-mode-toggle-2' #10

Closed
SergioArrighi opened this issue Nov 4, 2023 · 3 comments · Fixed by #11
Closed

Cannot find type definition file for '@types/react-dark-mode-toggle-2' #10

SergioArrighi opened this issue Nov 4, 2023 · 3 comments · Fixed by #11
Assignees
Labels
bug Something isn't working

Comments

@SergioArrighi
Copy link

image

Hello guys,

awesome work, the toggle is really cute and I wanted to use it for a small project of mine.
Unfortunately I cannot figure out why I have this error.

You can directly use my repo to reproduce I guess.
You need pnpm to install and start dev server.

https://github.com/SergioArrighi/portfolio/

Thanks and best regards

@indreklasn
Copy link

indreklasn commented Jan 2, 2024

Yep, this is a issue.

Use

// @ts-ignore
import { DarkModeToggle } from "react-dark-mode-toggle-2"

@todd-elvers
Copy link
Owner

Apologies for the late response.

I wasn't able to reproduce this with yarn or npm. I'll test it more extensively tomorrow with a repo that actually uses pnpm and get back to you.

@todd-elvers todd-elvers self-assigned this Jan 8, 2024
@todd-elvers todd-elvers added enhancement New feature or request bug Something isn't working and removed enhancement New feature or request labels Jan 8, 2024
@todd-elvers
Copy link
Owner

I was able to recreate this issue on a fresh React app w/ pnpm. The issue is related to how pnpm expects my package.json to specify the location of the types for this library. Adding an entry in exports for types fixes the issue.

todd-elvers added a commit that referenced this issue Jan 9, 2024
Specify types location in exports field of package.json - fixes #10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants