primevue icon indicating copy to clipboard operation
primevue copied to clipboard

PrimeOne Theme v4: Typescript error `Could not find a declaration file for module 'primevue/themes/primeone'` and aura theme

Open sceee opened this issue 10 months ago • 3 comments

Describe the bug

When using the PrimeOne theme with primevue 4.0.0-beta.1 and following the documentation here, I get several typescript errors:

error TS7016: Could not find a declaration file for module 'primevue/themes/primeone'. 'C:/....................../node_modules/primevue/themes/primeone/index.cjs.js' implicitly has an 'any' type.

35 import PrimeOne from 'primevue/themes/primeone'



error TS2306: File 'C:/......................../node_modules/primevue/themes/index.d.ts' is not a module.

1 import { definePreset } from 'primevue/themes'


error TS7016: Could not find a declaration file for module 'primevue/themes/primeone/aura'. 'C:/............................./node_modules/primevue/themes/primeone/aura/index.cjs.js' implicitly has an 'any' type.

2 import Aura from 'primevue/themes/primeone/aura'

Actually, node_modules\primevue\themes\index.d.ts is empty. For node_modules\primevue\themes\primeone\index.cjs.js I am not sure if it is correct that the cjs.js is "used" as there is also an index.esm.js in the same folder which does not seem to be used.

Reproducer

https://stackblitz.com/edit/primevue-create-vue-typescript-issue-template-3mcqk5?file=src%2Fmain.ts

PrimeVue version

4.0.0-beta.1

Vue version

3.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

// Also see the linked Stackblitz repro - in main.ts the editor highlights line 3-5 with the reported errors.

  1. Create a vite project using the Theme configuration example here
  2. Execute npx tsc

Expected behavior

No typescript compile errors occur, types are correct.

sceee avatar Apr 03 '24 15:04 sceee

+1 having the same issue.

When I go to build using Vite, I get the following notices:

Export "default" of module "node_modules/primevue/themes/config/index.esm.js" was reexported through module "node_modules/primevue/themes/index.esm.js" while both modules are dependencies of each other and will end up in different chunks by current Rollup settings. This scenario is not well supported at the moment as it will produce a circular dependency between chunks and will likely lead to broken execution order.

sn0rcha avatar Apr 24 '24 01:04 sn0rcha

Note: It changed a bit with primevue v4.0.0-beta.2 since there is no longer the base theme but the other errors remain.

sceee avatar May 03 '24 14:05 sceee

Thanks a lot for your reports! I'll fix it for the next release.

mertsincan avatar May 03 '24 16:05 mertsincan

This seems to be resolved now with the latest changes in #5774 and released with 4.0.0-rc.1 🎉 Thanks!

sceee avatar Jun 13 '24 15:06 sceee

Thanks a lot @sceee ;)

mertsincan avatar Jun 14 '24 08:06 mertsincan

fix confirmed - thanks @sceee :)

sn0rcha avatar Jun 14 '24 09:06 sn0rcha