Suppose that I have
type TYPE1 = {
id : number,
property1 : number
}
type TYPE2 = {
id : number,
property2 : number
}
and
type T = TYPE1 | TYPE2;
Is there a way of having typescript provide a warning or error if something like
const t: T = {
id : 0,
property1 : 0,
property2 : 0
}
appears elsewhere in the code as it is neither of TYPE1 nor TYPE2.