We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Current solution involves a lot of boilerplate code:
class A { constructor(a: number) { this._a = a; } private _a: number; get a(): number { return _a; }
It would be nice to have something simpler. Now you can define properties from the constructor, why not define getter there as well ?
class A { constructor(get a: number) { }
The text was updated successfully, but these errors were encountered:
You can use parameter properties today for similar shorthand:
class A { constructor(public x: number, private y: string) {} } var a:A; var r = a.x; // number var r2 = a.y; // error
See #12 for read only issues.
Sorry, something went wrong.
I know about shorthand. My intention is shorthand for readonly from constructor. I didn't see this proposal in the #12 .
@danquirk You sure meant to write a y in second parameter of your constructor right ??
y
Correct. Fixed. You'll probably be interested in #6532
No branches or pull requests
Current solution involves a lot of boilerplate code:
It would be nice to have something simpler.
Now you can define properties from the constructor, why not define getter there as well ?
The text was updated successfully, but these errors were encountered: