Subscribe on changes!

Strange error on explicitly set type to variable ref() as Ref

avatar
Feb 6th 2021

Version

3.0.5

Reproduction link

https://codesandbox.io/s/mutable-forest-ehehf?file=/src/index.ts

Steps to reproduce

  • create variable with type Ref
  • set value to ref(item) const data:Ref<Item> = ref(item)

What is expected?

no errors

What is actually happening?

vue try to convert type Item to ToRef<Item>

avatar
Feb 7th 2021

Here is the actual TS error:

Screenshot 2021-02-07 at 01 15 09

Do const data = ref<Item>(item)