primefaces / primevue

Next Generation Vue UI Component Library
https://primevue.org
MIT License
9.86k stars 1.19k forks source link

Primevue not working with strictTemplates enabled #6041

Open some-user123 opened 2 months ago

some-user123 commented 2 months ago

Describe the bug

To make use of type checking in the template, you have to enable vueCompilerOptions.strictTemplates in tsconfig.json.

Primevue components, e.g. <Button> are not registered properly and thus cause type errors like this:

app.vue:3:6 - error TS2339: Property 'Button' does not exist on type 'Pick<__VLS_GlobalComponents, "NuxtRouteAnnouncer"> & Pick<__VLS_GlobalComponents, "NuxtWelcome">'.

3     <Button label="Submit" />
       ~~~~~~

Reproducer

https://stackblitz.com/edit/nuxt-starter-wzq5r2

PrimeVue version

4.0.0

Vue version

3.x

Language

TypeScript

Build / Runtime

Nuxt

Browser(s)

No response

Steps to reproduce the behavior

  1. npm run install
  2. npm run typecheck

Expected behavior

Should pass without errors.

h-harsh commented 2 months ago

I am encountering a similar issue. When I disable strictTemplates, type checking for PrimeVue components no longer works. Is there a workaround to enable type checking for PrimeVue components without having to enable strictTemplates, since enabling it causes other issues?

h-harsh commented 2 months ago

Got this resolved The issue occurred when I set autoImport (autoImport of primevue components) to false and tried to use primevue components without manually importing it. Working fine with trictTemplates enabled