I am looking for a way to send an object through JSON that implements an interface, but also contains additional properties that I do not want to include. How can I filter out everything except the interface properties so that only a pure object is sent?
For example:
interface IBlock{
x:number;
y:number;
}
class Block implements IBlock{
public z:number;
}
...
send(JSON.stringify(new Block() as IBlock));
desiredResponse = "{x:0,y:0}";
receivedResponse = "{x:0,y:0,z:0}";