Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

types(withDefaults): enhance read-only type #8601

Merged
merged 2 commits into from
Nov 10, 2023

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