props with default values
What problem does this feature solve?
the props with default values need a method withDefaults
to wrap it, which I think not good.
chain call, currying may be better?
What does the proposed API look like?
const props = defineProps<{
title: string;
count?: number;
}>()({
count: 0,
}); // may be the inside is still call the withDefaults
const props = defineProps<{
title: string;
count?: number;
}>().defaults({
count: 0,
}); // call else
This has been discussed extensively in RFCs - neither can be done without type-related issues.
We will likely recommend using Reactive Transform in the future with reactive props destructure.