Skip to content

fix(runtime-core): merge return value when there is undefined value in withDefaults #7646

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

Closed
wants to merge 0 commits into from

Conversation

godxiaoji
Copy link
Contributor

From #7619, increase the judgment of undefined value in withDefaults.

At the same time, according to the requirements of the document, ensures the returned props type has the optional flags removed for properties.

const res = withDefaults(
  defineProps<{
    str?: string;
    bool: boolean;
  }>(),
  {
    str: undefined,
    bool: undefined
  }
);

// res.str: string | undefined
// res.bool: boolean | undefined

@edison1105
Copy link
Member

Could you please resolve the conflicts?

@godxiaoji godxiaoji closed this Oct 26, 2024
@godxiaoji godxiaoji force-pushed the with-defaults-undefined branch from f503172 to ed01d92 Compare October 26, 2024 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍰 p2-nice-to-have Priority 2: this is not breaking anything but nice to have it addressed. ready for review This PR requires more reviews scope: types
Projects
Status: Rejected
Development

Successfully merging this pull request may close these issues.

2 participants