Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/language-core/lib/codegen/globalTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export function generateGlobalTypes(options: VueCompilerOptions) {
: T extends string ? [string, number][]
: T extends any[] ? [T[number], number][]
: T extends Iterable<infer V> ? [V, number][]
: [T[keyof T], keyof T, number][];
: [T[keyof T], \`\${keyof T}\`, number][];
function __VLS_vSlot<S, D extends S>(slot: S, decl?: D):
D extends (...args: infer P) => any ? P : any[];
function __VLS_asFunctionalDirective<T>(dir: T): T extends import('${lib}').ObjectDirective
Expand Down
16 changes: 15 additions & 1 deletion test-workspace/tsc/passedFixtures/vue3/v-for/main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,22 @@
{{ exactType(key, {} as string) }}
{{ exactType(index, {} as number) }}
</div>
<!-- recordNumberKey -->
<div v-for="(val, key, index) in recordNumberKey">
{{ exactType(val, {} as string) }}
{{ exactType(key, {} as '1' | '2' | '3') }}
{{ exactType(index, {} as number) }}
</div>
<!-- recordUnionKey -->
<div v-for="(val, key, index) in recordUnionKey">
{{ exactType(val, {} as string) }}
{{ exactType(key, {} as 'a' | 'b') }}
{{ exactType(index, {} as number) }}
</div>
<!-- any -->
<div v-for="(val, index) in _any">
{{ exactType(val, {} as any) }}
{{ exactType(index, {} as string | number | symbol) }}
{{ exactType(index, {} as string | number) }}
</div>
</template>

Expand All @@ -52,5 +64,7 @@ const map = new Map<string, number>();
const obj = { a: '', b: 0 };
const objUnion = { a: '' } as { a: string } | { a: string, b: number };
const record: Record<string, string> = { a: '' };
const recordNumberKey: Record<1 | 2 | 3, string> = { 1: '', 2: '', 3: '' };
const recordUnionKey: Record<'a' | 'b', string> = { 'a': '', 'b': '' };
const _any = {} as any;
</script>