-
Notifications
You must be signed in to change notification settings - Fork 12.9k
fix(55899): Indexing/element access on super avoids instance property checks #55903
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
Conversation
If my memory serves me right, indexed accesses might've been an escape hatch to opt out of visibility modifiers. Maybe @RyanCavanaugh remembers better. That said, let's see how this works @typescript-bot perf test this |
Heya @DanielRosenwasser, I've started to run the regular perf test suite on this PR at 53a4088. You can monitor the build here. Update: The results are in! |
Heya @DanielRosenwasser, I've started to run the diff-based top-repos suite on this PR at 53a4088. You can monitor the build here. Update: The results are in! |
@DanielRosenwasser Here they are:
CompilerComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
tsserverComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
StartupComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
@DanielRosenwasser Here are the results of running the top-repos suite comparing Something interesting changed - please have a look. Details
|
Oh my |
So I guess a lot of people accidentally stumbled on this hole and used it to violate accessible rules? |
yeah, this has been repeatedly found as a "bug" but actually is a feature (#42360). maybe the team should add some comment in the checker, or emit a Message (hint) in IDE that this is violating visibility so people won't repeatedly report/fix this. |
Personally, I don't think this is a good hole to have. If someone wants to violate visibility rules, they can |
This is really nice way to access class properties in test while, for example, when testing angular components. I wish there was some legit way to side step private in test files without losing type information. :/ |
I don't think we can remove the accessibility checks without a broader discussion. If we want to reduce the scope to just |
We could always put it behind a strictness option if we're worried about it being a break - it's pretty in-line with the existing indexed-access relaxing option, suppressImplicitAnyIndexErrors, though admittedly not implicit- |
If the option joins the |
@DanielRosenwasser didn't we bring this up in a design meeting? Did we come to a conclusion on if we should merge this as-is or flag it as a strictness improvement? |
@DanielRosenwasser @RyanCavanaugh @weswigham @sandersn This PR has been open for a while., should these changes be under the |
This didn't come up at a design meeting yet - we should discuss it. That said, the affected test has a comment explaining the behavior: // Indexed access expressions have always permitted access to private and protected members.
// For consistency we also permit such access in indexed access types. So it probably makes more sense to have under a |
@DanielRosenwasser thank you for your feedback. I’d appreciate it if you could add it to the design meeting queue when you get a chance. |
Fixes #55899