const x: Example = {
toY: (y: Maple) => {
return y.p;
}
};
interface Example {
toY: (y: Pine) => void;
}
interface Pine {
c: string;
}
interface Maple extends Pine {
p: boolean;
}
Despite the warning for interface names, there is a discrepancy:
Type '(y: Maple) => Maple' is not compatible with type '(y: Pine) => void'. Parameters 'y' are incompatible.
Even though it functions properly, what is the correct approach to avoid this discrepancy?
Your help is truly appreciated.