Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vue template does not show typescript error when there is no explicit import on a primevue component #6750

Closed
woahitsjc opened this issue Nov 8, 2024 · 3 comments
Labels
Resolution: Cannot Replicate Issue could not be replicated by Core Team

Comments

@woahitsjc
Copy link

woahitsjc commented Nov 8, 2024

Describe the bug

I'm using primevue with typescript. I've got a pretty basic setup for initialising prime vue with the app:

app.use(PrimeVue, {
        theme: {
            preset: SomeCustomPreset,
            options: {
                darkModeSelector: "",
            }
        }
    });

The main issue is that typescript recognises primevue components in typings without explicit importing it. This does not cause any errors in the IDE/build and also does not render the component i.e. a primevue Card.

I don't want to use the autoimport approach because I prefer an explicit import and component.d.ts seems to cause a lot of issues like intellisense and file changes out of sync.

This is my tsconfig.json:

{
  "compilerOptions": {
    "target": "ES2020",
    "useDefineForClassFields": true,
    "module": "ESNext",
    "lib": [
      "ES2020",
      "DOM",
      "DOM.Iterable"
    ],
    "skipLibCheck": true,
    /* Bundler mode */
    "moduleResolution": "bundler",
    "allowImportingTsExtensions": true,
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "preserve",
    /* Linting */
    "strict": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noFallthroughCasesInSwitch": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "paths": {
      "@/*": ["./src/*"]
    }
  },
  "vueCompilerOptions": {
    "strictTemplates": true
  },
  "include": [
    "src/**/*.ts",
    "src/**/*.vue"
  ],
  "references": [
    {
      "path": "./tsconfig.node.json"
    }
  ]
}

I would like the error to appear compile time if I do forget to import this explicitly or register it as a global component. Any ideas how I can achieve this?

Reproducer

https://stackblitz.com/edit/primevue-4-ts-vite-issue-template-rxeego?file=src%2FApp.vue

PrimeVue version

4.2.1

Vue version

4.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

Inspect the App.vue and main.ts files in VSCode with the Vue - Official (Vue.volar) extension.

Expected behavior

Without a global component registered or an explicit import, Button should display an error message.
Or it should not having typing for Button as that is misleading.

@woahitsjc woahitsjc added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Nov 8, 2024
@Tamas-hi
Copy link
Contributor

I can confirm this is happening for me as well.

@tugcekucukoglu
Copy link
Member

How can replicate the issue?

@tugcekucukoglu tugcekucukoglu added Resolution: Cannot Replicate Issue could not be replicated by Core Team and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Nov 14, 2024
Copy link

We're unable to replicate your issue, if you are able to create a reproducer or add details please edit this issue. This issue will be closed if no activities in 20 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Cannot Replicate Issue could not be replicated by Core Team
Projects
None yet
Development

No branches or pull requests

3 participants