I have a class where I have the constructor defined with 3 parameters which are all optional. I was hoping to be able to pass in named parameters so I don't need to pass in undefined.
constructor(year?: number,
month?: number,
date?: number)
I was hoping to create an intance of the class like so
const recurrenceRule = new MyNewClass(month: 6)
but it didn't work and i tried
const recurrenceRule = new MyNewClass(month = 6)
and that didn't work.
The only way i got it to work was either
const recurrenceRule = new MyNewClass(undefined, 4)
or
const recurrenceRule = new MyNewClass(, 4)
But it seems so messy, I was hoping to pass in named arguments and becasue they are all optional I should be able to just pass in 1 - right ?