From cfec3b21867ac1189e38d43d73ed715c4aa9dc7a Mon Sep 17 00:00:00 2001 From: so1ve Date: Fri, 10 Oct 2025 11:09:18 +0800 Subject: [PATCH 1/5] wip --- packages/language-core/lib/codegen/script/component.ts | 2 +- packages/tsc/tests/typecheck.spec.ts | 2 ++ .../passedFixtures/fallthroughAttributes/#5680/child.vue | 7 +++++++ .../passedFixtures/fallthroughAttributes/#5680/main.vue | 8 ++++++++ 4 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 test-workspace/tsc/passedFixtures/fallthroughAttributes/#5680/child.vue create mode 100644 test-workspace/tsc/passedFixtures/fallthroughAttributes/#5680/main.vue diff --git a/packages/language-core/lib/codegen/script/component.ts b/packages/language-core/lib/codegen/script/component.ts index 6fa3464f2d..43d281abce 100644 --- a/packages/language-core/lib/codegen/script/component.ts +++ b/packages/language-core/lib/codegen/script/component.ts @@ -124,7 +124,7 @@ function* generatePropsOption( if (options.templateCodegen?.inheritedAttrVars.size) { let attrsType = `__VLS_InheritedAttrs`; - if (hasEmitsOption) { + if (hasEmitsOption && !options.vueCompilerOptions.fallthroughAttributes) { attrsType = `Omit<${attrsType}, \`on\${string}\`>`; } getOptionCodes.push(() => { diff --git a/packages/tsc/tests/typecheck.spec.ts b/packages/tsc/tests/typecheck.spec.ts index 198591bac1..dfc2344cc3 100644 --- a/packages/tsc/tests/typecheck.spec.ts +++ b/packages/tsc/tests/typecheck.spec.ts @@ -18,6 +18,8 @@ describe(`vue-tsc`, () => { "test-workspace/tsc/failureFixtures/directives/main.vue(12,2): error TS2578: Unused '@ts-expect-error' directive.", "test-workspace/tsc/failureFixtures/directives/main.vue(4,6): error TS2339: Property 'notExist' does not exist on type '{ exist: {}; $: ComponentInternalInstance; $data: {}; $props: {}; $attrs: Data; $refs: Data; $slots: Readonly; ... 8 more ...; $watch any)>(source: T, cb: T extends (...args: any) => infer R ? (args_0: R, args_1: R, args_2: OnCleanup) => any : (args_0: any, args_1...'.", "test-workspace/tsc/failureFixtures/directives/main.vue(9,6): error TS2339: Property 'notExist' does not exist on type '{ exist: {}; $: ComponentInternalInstance; $data: {}; $props: {}; $attrs: Data; $refs: Data; $slots: Readonly; ... 8 more ...; $watch any)>(source: T, cb: T extends (...args: any) => infer R ? (args_0: R, args_1: R, args_2: OnCleanup) => any : (args_0: any, args_1...'.", + "test-workspace/tsc/passedFixtures/fallthroughAttributes_strictTemplate/duplicateNameEvent/main.vue(7,33): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'never'. + Type 'string' is not assignable to type 'never'.", ] `); }); diff --git a/test-workspace/tsc/passedFixtures/fallthroughAttributes/#5680/child.vue b/test-workspace/tsc/passedFixtures/fallthroughAttributes/#5680/child.vue new file mode 100644 index 0000000000..b2f81f9fa3 --- /dev/null +++ b/test-workspace/tsc/passedFixtures/fallthroughAttributes/#5680/child.vue @@ -0,0 +1,7 @@ + + + diff --git a/test-workspace/tsc/passedFixtures/fallthroughAttributes/#5680/main.vue b/test-workspace/tsc/passedFixtures/fallthroughAttributes/#5680/main.vue new file mode 100644 index 0000000000..47b8b7b293 --- /dev/null +++ b/test-workspace/tsc/passedFixtures/fallthroughAttributes/#5680/main.vue @@ -0,0 +1,8 @@ + + + From 27a40d0d93bda0d086f05d93da14544a61e65d1c Mon Sep 17 00:00:00 2001 From: so1ve Date: Fri, 10 Oct 2025 11:22:38 +0800 Subject: [PATCH 2/5] nice --- packages/language-core/lib/codegen/script/component.ts | 4 ++-- packages/tsc/tests/typecheck.spec.ts | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/language-core/lib/codegen/script/component.ts b/packages/language-core/lib/codegen/script/component.ts index 43d281abce..2270a2538a 100644 --- a/packages/language-core/lib/codegen/script/component.ts +++ b/packages/language-core/lib/codegen/script/component.ts @@ -124,8 +124,8 @@ function* generatePropsOption( if (options.templateCodegen?.inheritedAttrVars.size) { let attrsType = `__VLS_InheritedAttrs`; - if (hasEmitsOption && !options.vueCompilerOptions.fallthroughAttributes) { - attrsType = `Omit<${attrsType}, \`on\${string}\`>`; + if (hasEmitsOption) { + attrsType = `Omit<${attrsType}, keyof __VLS_EmitProps>`; } getOptionCodes.push(() => { const propsType = `__VLS_PickNotAny<${ctx.localTypes.OmitIndexSignature}<${attrsType}>, {}>`; diff --git a/packages/tsc/tests/typecheck.spec.ts b/packages/tsc/tests/typecheck.spec.ts index dfc2344cc3..198591bac1 100644 --- a/packages/tsc/tests/typecheck.spec.ts +++ b/packages/tsc/tests/typecheck.spec.ts @@ -18,8 +18,6 @@ describe(`vue-tsc`, () => { "test-workspace/tsc/failureFixtures/directives/main.vue(12,2): error TS2578: Unused '@ts-expect-error' directive.", "test-workspace/tsc/failureFixtures/directives/main.vue(4,6): error TS2339: Property 'notExist' does not exist on type '{ exist: {}; $: ComponentInternalInstance; $data: {}; $props: {}; $attrs: Data; $refs: Data; $slots: Readonly; ... 8 more ...; $watch any)>(source: T, cb: T extends (...args: any) => infer R ? (args_0: R, args_1: R, args_2: OnCleanup) => any : (args_0: any, args_1...'.", "test-workspace/tsc/failureFixtures/directives/main.vue(9,6): error TS2339: Property 'notExist' does not exist on type '{ exist: {}; $: ComponentInternalInstance; $data: {}; $props: {}; $attrs: Data; $refs: Data; $slots: Readonly; ... 8 more ...; $watch any)>(source: T, cb: T extends (...args: any) => infer R ? (args_0: R, args_1: R, args_2: OnCleanup) => any : (args_0: any, args_1...'.", - "test-workspace/tsc/passedFixtures/fallthroughAttributes_strictTemplate/duplicateNameEvent/main.vue(7,33): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'never'. - Type 'string' is not assignable to type 'never'.", ] `); }); From ec08a5d69126445172eb41f9a4a2dbfbf24060fe Mon Sep 17 00:00:00 2001 From: Ray Date: Sat, 11 Oct 2025 03:14:59 +0800 Subject: [PATCH 3/5] Fix input element formatting in child.vue --- .../tsc/passedFixtures/fallthroughAttributes/#5680/child.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-workspace/tsc/passedFixtures/fallthroughAttributes/#5680/child.vue b/test-workspace/tsc/passedFixtures/fallthroughAttributes/#5680/child.vue index b2f81f9fa3..8c16eeb0a2 100644 --- a/test-workspace/tsc/passedFixtures/fallthroughAttributes/#5680/child.vue +++ b/test-workspace/tsc/passedFixtures/fallthroughAttributes/#5680/child.vue @@ -3,5 +3,5 @@ defineEmits<{ test: [] }>(); From 5d733eaa1e811c4852b560153f8a170df4d513bb Mon Sep 17 00:00:00 2001 From: Ray Date: Sat, 11 Oct 2025 03:15:21 +0800 Subject: [PATCH 4/5] Fix formatting of input event in main.vue --- .../tsc/passedFixtures/fallthroughAttributes/#5680/main.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-workspace/tsc/passedFixtures/fallthroughAttributes/#5680/main.vue b/test-workspace/tsc/passedFixtures/fallthroughAttributes/#5680/main.vue index 47b8b7b293..c7247f29ac 100644 --- a/test-workspace/tsc/passedFixtures/fallthroughAttributes/#5680/main.vue +++ b/test-workspace/tsc/passedFixtures/fallthroughAttributes/#5680/main.vue @@ -4,5 +4,5 @@ import { exactType } from '../../shared'; From f95fb40f4b5847506dd21958b6d7bdf98030d3ff Mon Sep 17 00:00:00 2001 From: Ray Date: Sat, 11 Oct 2025 09:00:03 +0800 Subject: [PATCH 5/5] Update test-workspace/tsc/passedFixtures/fallthroughAttributes/#5680/main.vue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 山吹色御守 <85992002+KazariEX@users.noreply.github.com> --- .../tsc/passedFixtures/fallthroughAttributes/#5680/main.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-workspace/tsc/passedFixtures/fallthroughAttributes/#5680/main.vue b/test-workspace/tsc/passedFixtures/fallthroughAttributes/#5680/main.vue index c7247f29ac..904b334ed8 100644 --- a/test-workspace/tsc/passedFixtures/fallthroughAttributes/#5680/main.vue +++ b/test-workspace/tsc/passedFixtures/fallthroughAttributes/#5680/main.vue @@ -1,5 +1,5 @@