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): introduce options to control type inference of $attrs, $el, $refs and $slots #5135

Merged
merged 16 commits into from
Feb 19, 2025

Conversation

KazariEX
Copy link
Collaborator

@KazariEX KazariEX commented Jan 18, 2025

close #5116, close #5183, close #5197, fix #5128

{
	"inferComponentDollarEl": {
	  "type": "boolean",
	  "default": false,
	  "markdownDescription": "Infer `$el` type on the component instance."
	},
	"inferComponentDollarRefs": {
	  "type": "boolean",
	  "default": false,
	  "markdownDescription": "Infer `$refs` type on the component instance."
	},
	"inferTemplateDollarAttrs": {
	  "type": "boolean",
	  "default": false,
	  "markdownDescription": "Infer `$attrs` type in the template and the return type of `useAttrs`."
	},
	"inferTemplateDollarEl": {
	  "type": "boolean",
	  "default": false,
	  "markdownDescription": "Infer `$el` type in the template."
	},
	"inferTemplateDollarRefs": {
	  "type": "boolean",
	  "default": false,
	  "markdownDescription": "Infer `$refs` type in the template."
	},
	"inferTemplateDollarSlots": {
	  "type": "boolean",
	  "default": false,
	  "markdownDescription": "Infer `$slots` type in the template and the return type of `useSlots`."
	}
}

Now the types of $el and $refs will not mount to component instance by default, but need to be enabled through the above options.

You can use comment syntax to turn on or off only for the current component:

<!-- @inferTemplateDollarSlots true -->

@KazariEX KazariEX changed the title feat(language-core): introduce options to control types of $attrs, $el, $refs and $slots feat(language-core): introduce options to control type inference of $attrs, $el, $refs and $slots Jan 18, 2025
Copy link

pkg-pr-new bot commented Jan 18, 2025

Open in Stackblitz

vue-component-meta

npm i https://pkg.pr.new/vuejs/language-tools/vue-component-meta@5135

vue-component-type-helpers

npm i https://pkg.pr.new/vuejs/language-tools/vue-component-type-helpers@5135

@vue/language-core

npm i https://pkg.pr.new/vuejs/language-tools/@vue/language-core@5135

@vue/language-plugin-pug

npm i https://pkg.pr.new/vuejs/language-tools/@vue/language-plugin-pug@5135

@vue/language-server

npm i https://pkg.pr.new/vuejs/language-tools/@vue/language-server@5135

@vue/language-service

npm i https://pkg.pr.new/vuejs/language-tools/@vue/language-service@5135

vue-tsc

npm i https://pkg.pr.new/vuejs/language-tools/vue-tsc@5135

@vue/typescript-plugin

npm i https://pkg.pr.new/vuejs/language-tools/@vue/typescript-plugin@5135

commit: 1365588

kiwikern added a commit to digitalservicebund/ris-backend-service that referenced this pull request Feb 18, 2025
RISDEV-0000
Can upgrade when vuejs/language-tools#5135 is merged
kiwikern added a commit to digitalservicebund/ris-backend-service that referenced this pull request Feb 18, 2025
* Update all-frontend-non-major-dependencies

* Downgrade vue-tsc

RISDEV-0000
Can upgrade when vuejs/language-tools#5135 is merged

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Kim Kern <[email protected]>
kiwikern added a commit to digitalservicebund/ris-backend-service that referenced this pull request Feb 18, 2025
RISDEV-6797
Revert this when vue-tsc fix is released, see vuejs/language-tools#5135
@KazariEX KazariEX merged commit b411d53 into vuejs:master Feb 19, 2025
5 checks passed
@KazariEX KazariEX deleted the feat/typed-dollar-options branch February 19, 2025 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants