and as a result, the type of props.prop inside setup(props) function (for instance) is:
But if I change interface to:
interface InterfaceWithAllOptionalKeys {
a: number | undefined;
b?: string;
}
then the type of props.prop is correct and is:
What's expected
To have type of props.prop equal InterfaceWithAllOptionalKeys for both interfaces.
How to reproduce
Code to reproduce the issue:
interface InterfaceWithAllOptionalKeys {
a?: number; // use `a: number | undefined;` to compare type of props.prop
b?: number;
}
defineComponent({
props: {
prop: {
type: Object as PropType<InterfaceWithAllOptionalKeys>,
required: true
}
},
setup(props) {
console.log(props.prop); // check type of props.prop in your IDE
}
});
Issue description
Let's say we have interface:
then we use that interface to describe some property
prop
of some component:and as a result, the type of
props.prop
insidesetup(props)
function (for instance) is:But if I change interface to:
then the type of
props.prop
is correct and is:What's expected
To have type of
props.prop
equalInterfaceWithAllOptionalKeys
for both interfaces.How to reproduce
Code to reproduce the issue: