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): typed fallthrough attributes #4103

Merged
merged 19 commits into from
Aug 25, 2024

Conversation

so1ve
Copy link
Member

@so1ve so1ve commented Mar 15, 2024

close #4049. close #4699.

Should add Co-authored-by: A5rocks <git@helvetica.moe> as a co-author


EDIT: This now requires adding an option fallthroughAttributes to vueCompilerOptions.

Co-authored-by: A5rocks <git@helvetica.moe>
@so1ve so1ve marked this pull request as draft March 15, 2024 09:27
@so1ve so1ve marked this pull request as ready for review March 15, 2024 09:28
@so1ve so1ve marked this pull request as draft March 15, 2024 09:28
@so1ve
Copy link
Member Author

so1ve commented Mar 20, 2024

I have no idea about #2472 💦

Copy link

pkg-pr-new bot commented Aug 25, 2024

commit: 938208e

vue-component-meta

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

vue-component-type-helpers

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

@vue/language-core

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

@vue/language-plugin-pug

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

@vue/language-server

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

@vue/language-service

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

vue-tsc

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

@vue/typescript-plugin

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

Open in Stackblitz

@johnsoncodehk johnsoncodehk changed the title feat: attribute inheritance feat(language-core): typed fallthrough attributes Aug 25, 2024
@johnsoncodehk johnsoncodehk marked this pull request as ready for review August 25, 2024 20:37
@johnsoncodehk johnsoncodehk merged commit 9da831f into vuejs:master Aug 25, 2024
5 checks passed
@johnsoncodehk
Copy link
Member

johnsoncodehk commented Aug 25, 2024

@A5rocks, @so1ve merged, well done! Next we can add highlighting to the target tag of fallthrough attributes.

@johnsoncodehk
Copy link
Member

Since this feature would significantly impact type checking speed, this feature was changed in ebb8490 to require fallthroughAttributes to be explicitly enabled in tsconfig.

@johnsoncodehk
Copy link
Member

johnsoncodehk commented Aug 27, 2024

This is a minimal reproduction of the case of slow tsc when fallthroughAttributes is enabled.

import { defineComponent } from 'vue';

const Foo = defineComponent({
	props: {} as __VLS_TypePropsToOption<{ bar?: string }>,
});
const Bar = defineComponent({
	props: {} as __VLS_TypePropsToOption<FooAttrs>,
});
defineComponent({
	setup() {
		return {};
	},
	props: {} as __VLS_TypePropsToOption<BarAttrs>,
});

type FooAttrs = __VLS_OmitIndexSignature<Partial<InstanceType<typeof Foo>['$props']>>;
type BarAttrs = __VLS_OmitIndexSignature<Partial<InstanceType<typeof Bar>['$props']>>;

type __VLS_TypePropsToOption<T> = {
	[K in keyof T]-?: {} extends Pick<T, K>
	? { type: import('vue').PropType<T[K]> }
	: { type: import('vue').PropType<T[K]>, required: true }
};
type __VLS_OmitIndexSignature<T> = { [K in keyof T as {} extends Record<K, unknown> ? never : K]: T[K]; };

@fabioconti
Copy link

fabioconti commented Sep 5, 2024

Just a question: it seems that when having strictTemplates and fallthroughAttributes both enabled on vueCompilerOptions, when some emits are defined on a component and trying to use native events binding on that component (ie: @click), vue-tsc is complaining about that. When configured in this way, is it fine that it complains about that? Should I forward native events that I want to use on my component?

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.

attribute inheritance when strictTemplates enabled
3 participants