core
core copied to clipboard
fix(runtime-core): merge return value when there is undefined value in `withDefaults`
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