Skip to content

unref返回数据类型异常 #8747

@tetezi

Description

@tetezi

Vue version

3.3.4

Link to minimal reproduction

https://play.vuejs.org/#eNp9kEFPwzAMhf+Klcs2qRpCu03bJEA7wAHQ4JhL6dzSrXWixNkmdf3vOC0dOwCHSNZ7z85nN+rO2ukhoJqrhc9caRk8crBQpVQstWKv1UpTWVvjGBoI5DCH5MHUNjBuN5gn8lrInalhJINGmjJDnoHR8xwo1B/oln3fGG4h9VLvyRwJYj2G78gZZM6ir1dwhqsfBnUCE02Lmx5zpRKBk6/yspjuvCHZoNEyVKtMWssK3YvlUlC0mkPnRC+tKnN86jR2AZNBzz4x2/+i7/wpalq9OvToDqjVxePUFci9vX57xpPUF7M221BJ+h9zg95UITL2sftAW8G+ynW0j93tSyre/frESH5YKoLGZNvltZLrx6v9tfoP7mw66/o0tar9AmJKqyI=

Steps to reproduce

const a: number= unref( 1 as unknown as ( number| Ref | ComputedRef) )

What is expected?

unref(data) 返回number 类型

What is actually happening?

unref(data) 返回number | ComputedRef ,因此报错不能将类型“number | ComputedRef”分配给类型“number”。

System Info

No response

Any additional comments?

unref参数同时存在ComputedRef,Ref,原类型的时候,返回参数类型会异常。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions