Skip to content

toRefs type is wrong when using defineProps with optional boolean props #5847

Closed
@extrem7

Description

@extrem7

Version

3.2.26

Reproduction link

stackblitz.com

Steps to reproduce

import { toRefs } from 'vue'

const props = defineProps<{
  isLive?: boolean
}>()

const { isLive } = toRefs(props)

What is expected?

According to fix(runtime-core): ensure declare prop keys are always present type of isLive should be:

Ref<boolean>

What is actually happening?

The type of isLive actually is:

Ref<boolean | undefined> | undefined

isLive couldn't be undefined in no case

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