primevue
primevue copied to clipboard
PrimeOne Theme v4: Typescript error `Could not find a declaration file for module 'primevue/themes/primeone'` and aura theme
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.
- Create a vite project using the Theme configuration example here
- Execute
npx tsc
Expected behavior
No typescript compile errors occur, types are correct.
+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.
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.
Thanks a lot for your reports! I'll fix it for the next release.
This seems to be resolved now with the latest changes in #5774 and released with 4.0.0-rc.1 🎉 Thanks!
Thanks a lot @sceee ;)
fix confirmed - thanks @sceee :)