Skip to content
Advertisement

Typescript optional object argument craziness

so I am trying to make a object parameter optional, with optional props, and have a default value at the same time:

JavaScript

this works fine, but notice that crazy function definition!

Any way to not repeat so much code?

Advertisement

Answer

I would probably write this like this:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement