From e816866333d3888f3363e699f0b8dde65f52c734 Mon Sep 17 00:00:00 2001 From: KazariEX <1364035137@qq.com> Date: Fri, 20 Dec 2024 23:09:36 +0800 Subject: [PATCH] fix(language-core): disable type inference of `useAttrs` and `$attrs` --- .../lib/codegen/script/scriptSetup.ts | 23 ++++++++++--------- .../lib/codegen/template/index.ts | 3 ++- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/packages/language-core/lib/codegen/script/scriptSetup.ts b/packages/language-core/lib/codegen/script/scriptSetup.ts index bb6ad08d80..0d7fbeffeb 100644 --- a/packages/language-core/lib/codegen/script/scriptSetup.ts +++ b/packages/language-core/lib/codegen/script/scriptSetup.ts @@ -170,17 +170,18 @@ function* generateSetupFunction( ]); } } - for (const { callExp } of scriptSetupRanges.useAttrs) { - setupCodeModifies.push([ - [`(`], - callExp.start, - callExp.start - ], [ - [` as __VLS_TemplateResult['attrs'] & Record)`], - callExp.end, - callExp.end - ]); - } + // TODO: circular reference + // for (const { callExp } of scriptSetupRanges.useAttrs) { + // setupCodeModifies.push([ + // [`(`], + // callExp.start, + // callExp.start + // ], [ + // [` as __VLS_TemplateResult['attrs'] & Record)`], + // callExp.end, + // callExp.end + // ]); + // } for (const { callExp, exp, arg } of scriptSetupRanges.useCssModule) { setupCodeModifies.push([ [`(`], diff --git a/packages/language-core/lib/codegen/template/index.ts b/packages/language-core/lib/codegen/template/index.ts index 1dd9458aa3..4fd82c74da 100644 --- a/packages/language-core/lib/codegen/template/index.ts +++ b/packages/language-core/lib/codegen/template/index.ts @@ -35,7 +35,8 @@ export function* generateTemplate(options: TemplateCodegenOptions): Generator