Skip to content

Conversation

@zqran
Copy link
Contributor

@zqran zqran commented Jun 19, 2023

Props should also be read-only in the following two cases:

const props = withDefaults(defineProps<{ name?: string }>(), {})
props.name // readonly
const props = withDefaults(defineProps<{ name?: string }>(), {
  name: ''
})
props.name // readonly

Copy link
Member

@sxzz sxzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sxzz sxzz added the ready to merge The PR is ready to be merged. label Aug 21, 2023
@yyx990803 yyx990803 merged commit f15debc into vuejs:main Nov 10, 2023
@zqran zqran deleted the 0619-props-with-defaults branch November 10, 2023 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready to merge The PR is ready to be merged.

Projects

Development

Successfully merging this pull request may close these issues.

3 participants