daisyui icon indicating copy to clipboard operation
daisyui copied to clipboard

DaisyUI can't find type module

Open Senbonzakura1234 opened this issue 2 years ago โ€ข 6 comments

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 <button class="btn">My DaisyUI button</button> 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

Senbonzakura1234 avatar Nov 18 '22 10:11 Senbonzakura1234

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.

yajatvishwak avatar Nov 20 '22 03:11 yajatvishwak

@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.

VictorGlindasPaf avatar Nov 21 '22 08:11 VictorGlindasPaf

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

aneiosi avatar Dec 01 '22 19:12 aneiosi

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?

Senbonzakura1234 avatar Dec 15 '22 17:12 Senbonzakura1234

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.

soorria avatar Dec 29 '22 10:12 soorria

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

HugoRamonPereira avatar Dec 30 '22 15:12 HugoRamonPereira