|
|
|
|
|
by MrJohz
1231 days ago
|
|
In that case, why not just create an object? With a constructor function, that could look something like (name: string, age: number) => ({ name, age: age * 2 })
Or even just without the constructor, if the data is so simple: { name: "Bill", age: 62 }
I'd have thought that would be the quickest option, because then you're not messing around with prototypes at all.Also, what do you mean by the accessor shorthand? I don't know what you mean off the top of my head, and searching for it has just brought me back to this post! |
|
Accessors: https://devblogs.microsoft.com/typescript/announcing-typescr...