formkit icon indicating copy to clipboard operation
formkit copied to clipboard

Unable to import `@formkit/themes/tailwindcss` with TypeScript

Open yf-hk opened this issue 3 years ago • 4 comments

Reproduction

https://codesandbox.io/s/goofy-currying-rnursq?file=/tailwind.config.ts

Describe the bug

image

Error message: Cannot find module '@formkit/themes/tailwindcss' or its corresponding type declarations.ts(2307)

Environment

• OS: not related • Browser: not related • Version: ^1.0.0-beta.11-0dd967c

yf-hk avatar Sep 05 '22 09:09 yf-hk

We'll need more information than this — what build tool are you use (nuxt/vite etc) what version of node. Ideally you could provide a reproduction.

justin-schroeder avatar Sep 06 '22 12:09 justin-schroeder

Well I'm using nuxt 3, but I think the issue is platform / configuration agnostic. The problem is that there is no actual typescript type for it. Here is the test enviroment: https://codesandbox.io/s/goofy-currying-rnursq?file=/tailwind.config.ts

yf-hk avatar Sep 06 '22 14:09 yf-hk

For now you can use import tailwind from "@formkit/themes/dist/tailwindcss"; instead, there are typescript types for it, but they are being read by the package.json exports types, maybe something wrong there or nuxt does not read them correctly.

fenilli avatar Sep 07 '22 15:09 fenilli

After looking it up it seens to not be a bug with formkit but with typescript itself as per #33079

fenilli avatar Sep 07 '22 15:09 fenilli