-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Open
Labels
Description
Vue version
@ea24576
Link to minimal reproduction
Steps to reproduce
shallowReactive object gets incorrectly typed when used in v-for:
<script setup>
import { shallowReactive } from 'vue'
const obj = shallowReactive({
a: { title: 'A' },
b: { title: 'B' },
})
</script>
<template>
<h1 v-for="item in obj">{{ item.title }}</h1>
<!-- ^^^^^
-->
</template>What is expected?
No error, and
typeof item // { title: string }What is actually happening?
Typescript error:
Property 'title' does not exist on type 'true | { title: string; } | { title: string; }'.
Property 'title' does not exist on type 'true' .ts(2339)
System Info
Any additional comments?
I found these typings in vue, I guess it might come from here
declare const ShallowReactiveMarker: unique symbol;
export type ShallowReactive<T> = T & {
[ShallowReactiveMarker]?: true;
};Reactions are currently unavailable