An error is reported on the external TS interface
Version
3.2.16
Reproduction link
Steps to reproduce
import {ForgetProps} from "@/types/login";
const props = withDefaults(defineProps<ForgetProps>(), {
visible: false
})
What is expected?
Child component:
import {ForgetProps} from "@/types/login";
const props = withDefaults(defineProps<ForgetProps>(), {
visible: false
})
ForgetProps:
export interface ForgetProps {
visible: boolean;
type: boolean;
}
I expect him to be right!
but, However, it is correct to use this in the component and will not report an error!
interface Props {
visible: boolean
}
const props = withDefaults(defineProps<Props>(), {
visible: false
})
What is actually happening?
It is wrong because: type argument passed to defineProps() must be a literal type, or a reference to an interface or literal type.
I don't know if it's because the syntax is incorrect or this syntax is not supported