From 8db00176cc61cbca2d20c187219f5f478fadc833 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=B1=E5=90=B9=E8=89=B2=E5=BE=A1=E5=AE=88?= <85992002+KazariEX@users.noreply.github.com> Date: Tue, 7 Jan 2025 23:29:25 +0800 Subject: [PATCH] fix(language-core): intersect local `$attrs` with `__VLS_ctx.$attrs` (#5113) --- .../language-core/lib/codegen/template/index.ts | 2 +- test-workspace/tsc/passedFixtures/#5111/main.vue | 15 +++++++++++++++ .../tsc/passedFixtures/#5111/tsconfig.json | 4 ++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 test-workspace/tsc/passedFixtures/#5111/main.vue create mode 100644 test-workspace/tsc/passedFixtures/#5111/tsconfig.json diff --git a/packages/language-core/lib/codegen/template/index.ts b/packages/language-core/lib/codegen/template/index.ts index 565cb4f87a..99b98edbcd 100644 --- a/packages/language-core/lib/codegen/template/index.ts +++ b/packages/language-core/lib/codegen/template/index.ts @@ -124,7 +124,7 @@ function* generateInheritedAttrs( } yield `]${endOfLine}`; } - return `Partial & Record`; + return `typeof __VLS_ctx.$attrs & Partial`; } function* generateRefs( diff --git a/test-workspace/tsc/passedFixtures/#5111/main.vue b/test-workspace/tsc/passedFixtures/#5111/main.vue new file mode 100644 index 0000000000..edc5f1f287 --- /dev/null +++ b/test-workspace/tsc/passedFixtures/#5111/main.vue @@ -0,0 +1,15 @@ + + + diff --git a/test-workspace/tsc/passedFixtures/#5111/tsconfig.json b/test-workspace/tsc/passedFixtures/#5111/tsconfig.json new file mode 100644 index 0000000000..5edd1fb1db --- /dev/null +++ b/test-workspace/tsc/passedFixtures/#5111/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../../tsconfig.base.json", + "include": [ "**/*" ] +} \ No newline at end of file