Skip to content

Conversation

@NicolaiHorlacher
Copy link
Contributor

@NicolaiHorlacher NicolaiHorlacher commented Aug 1, 2025

Remove GlobalComponents Type Definitions

The Vue Language Tool picks up every GlobalComponents definition in the entire project directory, including those in node_modules. This causes type pollution for all users, even if they are not globally importing components or are using a name prefix for their global imports.

Implications for users that don't use global component imports

The Vue Language Tool explicitly states:

After registering your global components you can register them in the GlobalComponents interface.
-See: https://github.com/vuejs/language-tools/wiki/Global-Component-Types

Component auto import is optional when using PrimeVue. So it's a bad idea to register these types globally for every user.

These definitions confuse autocomplete and import automation in code editors. Also type safety is greatly hindered, because type checker and linter cannot distinguish whether the component is actually imported globally or not. Degrading the developer experience.

Implications for users that do use global component imports

These type definitions are also of little use for users who use global component imports.
When using auto-imports with unplugin-vue-components, the plugin automatically generates the necessary global types, making these manual definitions redundant. See: Link

Ecosystem

  • No other major vue component library exposes global component types in this way.
  • This behaviour is discouraged, as seen in the Vue Language Tool documentation above.
  • Because PrimeVue components share some names with native HTML Tags, These global type definition impacting intellisense on native <button> and <select> components.

How was this issue introduced?

When PrimeTek introduced better type definitions for PrimeVue components in 2021, a global type definition was also added for every component. See: #1836

Because the global definition were done wrong in the first place, the type definitions were updated to match vue standards in 2024: See: #5419

Since then the Vue Language Tools wrongly assume that every PrimeVue component is imported globally.

Other Related Issues

Removing these definitions will reduce confusion, prevent type pollution, and align the project with best practices in the Vue ecosystem.

As an alternative to removing them completely, they could be published in another package. So users who need them can install them explicitly. But as mentioned above, unplugin-vue-components can create the type definition by itself. So a extra package wouldn't have much use.

closes: #7978

@cagataycivici
Copy link
Member

Thanks, we'll review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vue Language Tool assumes every component is imported globally

2 participants