Its still unclear to me why this
const ab_v1: A_and_B = {
doIt: (a: string) => { }
}
did not raise error even this on does not match with the interface B. And A_B should march both.
Can you please elaborate on this difference?
Thanks
Its still unclear to me why this
const ab_v1: A_and_B = {
doIt: (a: string) => { }
}
did not raise error even this on does not match with the interface B. And A_B should march both.
Can you please elaborate on this difference?
Thanks
@parth1
The type of ‘a’ property in type B is intersected with the type of ‘a’ property in type A. That’s why for
ab_v1, both types A and B are intersected to string and we do not get any error here.
But in ab_v2 case, the type of ‘b’ property in type B is not intersected with type A because we don’t have property ‘b’ here. That’s why getting an error here.