From TS's perspective, there's no difference between this code and
const func = (obj1: A[] | B[], obj2: A[] | B[]):void => {
obj1[0].children.push(obj2[1])
}
which is clearly unsafe. We don't track where objects "came from" to establish higher-order relations.
Originally posted by @RyanCavanaugh in microsoft/TypeScript#52084 (comment)