for example, I have an interface:
interface Foo {
value1: number;
value2: number;
}
I'd like to add a sum() method that would give me a sum of values on any instance of this interface. What is a Typescript's way of doing this?
I need to be able to write a function like this:
function printFooSum(foo: Foo) {
console.log(???);
}
and the function should not involve manual assignment of foo properties to some other class.