Yet another variant with checking set of keys:
function areEqual(one: keyof A extends 'x' | 'y' ? A : unknown, another: A): boolean { return one.x === another.x && one.y === another.y; }
https://tsplay.dev/NaM82N