Skip to content

Commit

Permalink
fix(language-core): intersect local $attrs with __VLS_ctx.$attrs (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
KazariEX authored Jan 7, 2025
1 parent f68dafb commit 8db0017
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/language-core/lib/codegen/template/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function* generateInheritedAttrs(
}
yield `]${endOfLine}`;
}
return `Partial<typeof __VLS_inheritedAttrs> & Record<string, unknown>`;
return `typeof __VLS_ctx.$attrs & Partial<typeof __VLS_inheritedAttrs>`;
}

function* generateRefs(
Expand Down
15 changes: 15 additions & 0 deletions test-workspace/tsc/passedFixtures/#5111/main.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<script setup lang="ts">
import { exactType } from '../shared';
declare module 'vue' {
interface ComponentCustomProperties {
$attrs: {
global: string;
}
}
}
</script>

<template>
{{ exactType($attrs.global, {} as string) }}
</template>
4 changes: 4 additions & 0 deletions test-workspace/tsc/passedFixtures/#5111/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "../../../tsconfig.base.json",
"include": [ "**/*" ]
}

0 comments on commit 8db0017

Please sign in to comment.