This question reminds me of another question I came across, but it's not quite the same and I'm still struggling to figure it out.
Basically, I need to duplicate a data structure but remove all the methods from it.
interface XYZ {
x: number;
y: string;
z(): void;
}
So in this case, I want to exclude the method z
and end up with:
interface XY {
x: number;
y: string;
}
I am aware that I can use the Omit
utility type like this:
type OmitZ = Omit<XYZ, "z">;
However, I actually want to omit based on property type rather than key string. Is there a way to achieve this?