|
|
|
|
|
by wffurr
1232 days ago
|
|
>> Try using object destructuring in a class constructor to create optional named parameters for a class. Works perfectly in Vanilla JS, but TS will throw a hissy-fit. What? You mean like this? class Foo {
constructor({opt1, opt2, opt3}: {opt1: string, opt2?: number, opt3?: Object}) {
}
}
https://www.typescriptlang.org/play?#code/MYGwhgzhAEBiD29oG8... |
|