so I've recently came across this case, having these 3 interfaces:
interface a {
id: string,
name: string
}
interface b {
id: string,
name: string,
age: string,
}
interface c {
id: string,
name:string,
color: string
}
Assinging these types to a variable:
const selectedType: Ref< a | b | c | null> = ref(null);
and having a component (lest call it modal):
<LW2Modal :title="'modal'" v-model:currentType="selectedType" /></LW2Modal>
which its props are:
const props = withDefaults(
defineProps<{
currentType: a | b | null
}>(),
{},
);
It's giving an error that I'm missing ("c") obviously, but this modal is only intended to modify a | b, I'm doing this TO NOT HAVE MULTIPLE VARIABLES WHEN SELECTING ANY TYPE
is there a way for typescript to accept this?
Thanks guys :)