Think about this:
interface Options {
length?: number,
width?: number
}
interface Action {
performAction ({length, width}: Options): void
}
const myObject: Action = {
performAction ({length, width}) {
// do something without returning anything
}
}
Both inputs are marked as optional, which means I can call performAction like this:
myObject.performAction() // although it doesn't go through
I encountered an Error saying "Expected 1 argument, but received 0".
Am I overlooking anything? How should I define an Interface with all optional parameters?