chore: remove GlobalComponents type definitions #7977
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Remove
GlobalComponentsType DefinitionsThe Vue Language Tool picks up every
GlobalComponentsdefinition in the entire project directory, including those innode_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:
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
<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-componentscan create the type definition by itself. So a extra package wouldn't have much use.closes: #7978