-
Notifications
You must be signed in to change notification settings - Fork 12.4k
New issue
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
Private symbol class properties treated as public #20080
Comments
some background in #19545 (comment). Today there is no way to write this file a .d.ts and not expose we can possibly fix this by adding an auto-generated |
I think I was under the assumption that private properties don't get emitted to the .d.ts files. Is that not the case? |
They need to be emitted to the .d.ts to avoid derived classes creating members with he same name. |
Two things:
|
If the symbol isn't exported, it's literally unknowable, so you can't have the same name it in a derived class (which is, of course, our entire reason for not exporting it) |
There is some historical context why things work the way they do.. please see #19545 (comment) for more details. |
@dpogue I've opened a PR to elide the property like @mhegazy was talking about; but your original error in the OP is not the error you'd get from the declaration emit of that property - from my explorations, the error you've given occurs when a global |
I do have |
TypeScript Version: 2.7.0-dev.20171116
Code
Expected behavior:
Compiles successfully.
Actual behavior:
TS4031: Public property '[_data]' of exported class has or is using private name '_data'.
The issue is that
[_data]
is not a public property, so it shouldn't care if it's using a private name because it's not meant to be visible outside of the User class.The text was updated successfully, but these errors were encountered: