Skip to content

Using generic for ref() causes error when reassigning #6766

Closed
@ycmjason

Description

@ycmjason

Vue version

3.2.40

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-rpmhsh?file=src/main.ts

Steps to reproduce

ref(t) where t is of type generic T will cause error when reassigning the ref to a value of T.

What is expected?

expected refOfT.value = t to work

What is actually happening?

image

Got an error

Type 'T' is not assignable to type 'UnwrapRef<T>'.

System Info

No response

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions