I have an interface like the following:
interface Cat {
age? : number
name? : string
}
with the following scenario:
function getAge(cat: Cat) {
// ...
}
const catWithAge = getAge({}) // this is ok according the Cat interface
What I would like to do is the function getAge
not to accept an empty object.
I would like to have at least one key passed in the object (doesn't matter which one).
What should I change in order to achieve this?