interface Intf {
prop: ComputedRef<string>;
}
const obj = {} as Intf;
console.log(obj.prop.value);
I have the above code which looks good as what I expected. I can access obj.prop.value
and no error was thrown from typescript. However, when I put this ComputedRef<string>
inside another reactive object, I cannot retrieve it back as typescript said the prop
is in type string
instead of ComputedRef<string>
. Let see the following codes:
interface Intf {
prop: ComputedRef<string>;
}
const re = reactive({
obj: {} as Intf
});
console.log(re.obj.prop.value); // typescript shown error on this line, `re.obj.prop` is with type `string` instead of `ComputedRef<string>`. At the moment, I cannot retrieve `prop.value` by accessing `prop` as well, since prop is a `ComputedRef<string>` and I should get its value by accessing `prop.value`!!