Skip to content

Commit 8db0017

Browse files
authored
fix(language-core): intersect local $attrs with __VLS_ctx.$attrs (#5113)
1 parent f68dafb commit 8db0017

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

packages/language-core/lib/codegen/template/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ function* generateInheritedAttrs(
124124
}
125125
yield `]${endOfLine}`;
126126
}
127-
return `Partial<typeof __VLS_inheritedAttrs> & Record<string, unknown>`;
127+
return `typeof __VLS_ctx.$attrs & Partial<typeof __VLS_inheritedAttrs>`;
128128
}
129129

130130
function* generateRefs(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<script setup lang="ts">
2+
import { exactType } from '../shared';
3+
4+
declare module 'vue' {
5+
interface ComponentCustomProperties {
6+
$attrs: {
7+
global: string;
8+
}
9+
}
10+
}
11+
</script>
12+
13+
<template>
14+
{{ exactType($attrs.global, {} as string) }}
15+
</template>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": "../../../tsconfig.base.json",
3+
"include": [ "**/*" ]
4+
}

0 commit comments

Comments
 (0)