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

feat(language-core): support @vue-generic #4971

Merged
merged 7 commits into from
Nov 2, 2024

Conversation

KazariEX
Copy link
Collaborator

@KazariEX KazariEX commented Oct 31, 2024

resolve vuejs/core#8015

@KazariEX KazariEX changed the title feat: support v-generic feat(language-core): support v-generic Oct 31, 2024
Copy link

pkg-pr-new bot commented Oct 31, 2024

Open in Stackblitz

vue-component-meta

pnpm add https://pkg.pr.new/vuejs/language-tools/vue-component-meta@4971

vue-component-type-helpers

pnpm add https://pkg.pr.new/vuejs/language-tools/vue-component-type-helpers@4971

@vue/language-plugin-pug

pnpm add https://pkg.pr.new/vuejs/language-tools/@vue/language-plugin-pug@4971

@vue/language-core

pnpm add https://pkg.pr.new/vuejs/language-tools/@vue/language-core@4971

@vue/language-server

pnpm add https://pkg.pr.new/vuejs/language-tools/@vue/language-server@4971

@vue/language-service

pnpm add https://pkg.pr.new/vuejs/language-tools/@vue/language-service@4971

vue-tsc

pnpm add https://pkg.pr.new/vuejs/language-tools/vue-tsc@4971

@vue/typescript-plugin

pnpm add https://pkg.pr.new/vuejs/language-tools/@vue/typescript-plugin@4971

commit: 63c4f50

@KazariEX KazariEX marked this pull request as ready for review October 31, 2024 18:19
@johnsoncodehk
Copy link
Member

I think writing types in v-generic is wrong in Vue's specification, according to the documentation custom directives only receive JS statements, the v-generic convention may break compatibility with other tools/libraries.

We should use generic, or convention to pass type parameters in HTML comment through <!-- @vue-generic {xxx} -->.

@KazariEX
Copy link
Collaborator Author

KazariEX commented Nov 1, 2024

The runtime support for v-generic only requires the use of noopDirectiveTransform to skip the compile of this directive vuejs/core#12301, which should only cause the user's custom directive with the same name to become invalid.

@johnsoncodehk
Copy link
Member

@KazariEX I see, but this will still break Vue versions prior to vuejs/core#12301, especially since Vue 2 has stopped being maintained. Since this is a language tools specific feature, we need an implementation that doesn't have to change core.

@KazariEX
Copy link
Collaborator Author

KazariEX commented Nov 1, 2024

Can we consider it as a feature of the next minor version?

@KazariEX KazariEX changed the title feat(language-core): support v-generic feat(language-core): support @vue-generic Nov 2, 2024
@johnsoncodehk johnsoncodehk merged commit 4c3c8c4 into vuejs:master Nov 2, 2024
5 checks passed
@KazariEX KazariEX deleted the feat/v-generic branch November 2, 2024 11:26
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.

Support passing generic to child components
3 participants