You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using TypeScript with named parameters massively like this.
class User {
public firstName: string;
public lastName: string;
constructor({firstName, lastName}: {firstName: string, lastName: string}) {
this.firstName = firstName;
this.lastName = lastName;
}
}
new User({firstName: 'Foo', lastName: 'BAR'});
And I would love to be able to generate the properties automatically like this.
class User {
constructor({public firstName, public lastName}: {firstName: string, lastName: string}) {}
}
new User({firstName: 'Foo', lastName: 'BAR'});
I think that this feature can be really interesting and would encourage more developers to use named parameters which I think is one of the most important best practices in TypeScript and any other language by the way.
Thank you in advance.
The text was updated successfully, but these errors were encountered:
Hi!
I'm using TypeScript with named parameters massively like this.
And I would love to be able to generate the properties automatically like this.
I think that this feature can be really interesting and would encourage more developers to use named parameters which I think is one of the most important best practices in TypeScript and any other language by the way.
Thank you in advance.
The text was updated successfully, but these errors were encountered: