saadeghi / daisyui

🌼 🌼 🌼 🌼 🌼  The most popular, free and open-source Tailwind CSS component library
https://daisyui.com
MIT License
33.97k stars 1.3k forks source link

DaisyUI can't find type module #1366

Closed Senbonzakura1234 closed 1 year ago

Senbonzakura1234 commented 1 year ago

Discussed in https://github.com/saadeghi/daisyui/discussions/819

Originally posted by **huskyjp** May 28, 2022 I do have Nextjs & Tailwind codebase and just implemented daisyui by `npm i daisyui` . Then added `plugins: [require('daisyui')]` in tailwind.config.js file. I get a warning error that says like below and I believe typescript currently can not find daisyui type file?? ``` Could not find a declaration file for module 'daisyui'. '/Users/dev//node_modules/daisyui/src/index.js' implicitly has an 'any' type. Try `npm i --save-dev @types/daisyui` if it exists or add a new declaration (.d.ts) file containing `declare module 'daisyui';`ts(7016) ``` Also - when I tried to simply implemet some daisyui component like `````` it just shows text without any daisyui design. I am not sure if the root problem is typescript error but when I start running the app, I get the daisyUI message so I believe the implementation is good but not working correctly for some reasaons. ``` daisyUI components 2.15.1 https://github.com/saadeghi/daisyui ✔︎ Including: base, components, themes[29], utilities ``` Would love to know following points 🙏 - the type error reason - any possible reason why daisyui component is not working
yajatvishwak commented 1 year ago

Try using the repo examples as a boilerplate to start your project. here: https://stackblitz.com/edit/daisyui-nextjs?file=package.json

I'm guessing it has to do with the way you set up your project.

VictorGlindasPaf commented 1 year ago

@yajatvishwak It's not. I'm getting the same issue, and it's due to there existing no type declarations anywhere. So ideally either the published package should contain type definitions, or they should exist under @types/daisyui.

aneiosi commented 1 year ago

having the same issue

the best way to fix it IMHO would be to create a "@types/daisyui" package at https://github.com/definitelytyped/definitelytyped

Senbonzakura1234 commented 1 year ago

having the same issue

the best way to fix it IMHO would be to create a "@types/daisyui" package at https://github.com/definitelytyped/definitelytyped

do you know the shape of daisyui export thou?

soorria commented 1 year ago

Hey! I'm happy to take this issue if no one else has started work. I've added types for some (much smaller) Tailwind plugins I've written so should be pretty simple. I'm also planning on adding types for the config so you should get intellisense for the daisyui field in your tailwind.config.js.

HugoRamonPereira commented 1 year ago

Hey! I'm happy to take this issue if no one else has started work. I've added types for some (much smaller) Tailwind plugins I've written so should be pretty simple. I'm also planning on adding types for the config so you should get intellisense for the daisyui field in your tailwind.config.js.

Great, I am having this issue Screenshot 2022-12-30 at 12 19 30