Skip to content

ref returned by toRefs(props) have type Ref<X | undefined> | undefined #6420

@Waujito

Description

@Waujito

Vue version

latest, 3.2.37

Link to minimal reproduction

https://codesandbox.io/s/vigorous-sound-6m9x2d

Steps to reproduce

Check sandbox link provided in minimal reproduction field and run npm run type-check in terminal:
изображение

What is expected?

Expected that the type-check action returns no error in buggedComponent.vue that is
the type of optionalProperty in anyProperty assignation detects as string because all conditions that may detect and prevent undefined type are passed:
изображение

What is actually happening?

typescript compiler detects type of the optionalProperty in anyProperty assign condition as string|undefined

System Info

No response

Any additional comments?

If you dont want to check the reproduction link, there are some photos that describes the problem:изображение
изображение
изображение

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions