Skip to content

Commit

Permalink
fix(language-core): disable type inference of useAttrs and $attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
KazariEX committed Dec 20, 2024
1 parent 4fff892 commit e816866
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
23 changes: 12 additions & 11 deletions packages/language-core/lib/codegen/script/scriptSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,17 +170,18 @@ function* generateSetupFunction(
]);
}
}
for (const { callExp } of scriptSetupRanges.useAttrs) {
setupCodeModifies.push([
[`(`],
callExp.start,
callExp.start
], [
[` as __VLS_TemplateResult['attrs'] & Record<string, unknown>)`],
callExp.end,
callExp.end
]);
}
// TODO: circular reference
// for (const { callExp } of scriptSetupRanges.useAttrs) {
// setupCodeModifies.push([
// [`(`],
// callExp.start,
// callExp.start
// ], [
// [` as __VLS_TemplateResult['attrs'] & Record<string, unknown>)`],
// callExp.end,
// callExp.end
// ]);
// }
for (const { callExp, exp, arg } of scriptSetupRanges.useCssModule) {
setupCodeModifies.push([
[`(`],
Expand Down
3 changes: 2 additions & 1 deletion packages/language-core/lib/codegen/template/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ export function* generateTemplate(options: TemplateCodegenOptions): Generator<Co
if (options.propsAssignName) {
ctx.addLocalVariable(options.propsAssignName);
}
ctx.addLocalVariable('$attrs');
// TODO: circular reference
// ctx.addLocalVariable('$attrs');
ctx.addLocalVariable(getSlotsPropertyName(options.vueCompilerOptions.target));
ctx.addLocalVariable('$refs');
ctx.addLocalVariable('$el');
Expand Down

0 comments on commit e816866

Please sign in to comment.