-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Restrict indexed accesses on nonpublic fields of concrete types the same way we do generic ones #61291
base: main
Are you sure you want to change the base?
Conversation
…ame way we do generic ones
@typescript-bot test it |
@typescript-bot pack this |
Hey @gabritto, I've packed this into an installable tgz. You can install it for testing by referencing it in your
and then running There is also a playground for this build and an npm module you can use via |
@gabritto Here are the results of running the user tests with tsc comparing Everything looks good! |
Hey @gabritto, the results of running the DT tests are ready. There were interesting changes: Branch only errors:Package: koa2-ratelimit
Package: inquirer/v8
Package: inquirer
|
@gabritto Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
Yes and no. This is only for the type form, because the type causes errors (well, |
@gabritto Here are the results of running the top 400 repos with tsc comparing Something interesting changed - please have a look. Details
|
@typescript-bot test it |
@weswigham Here are the results of running the user tests with tsc comparing Everything looks good! |
Hey @weswigham, the results of running the DT tests are ready. Everything looks the same! |
@weswigham Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
@weswigham Here are the results of running the top 400 repos with tsc comparing Something interesting changed - please have a look. Details
|
Historically, we've allowed these accesses because they resolve to a concrete type (even if the inspection of privates was pretty suspect) which is then what usually appears in declaration emit - but we retain type nodes as written quite a lot now, so it's a bit more problematic now, as we easily retain references to private members with elided types. As-is, I apply the check for both private and protected members for concrete types, since that's what we already errored on for generic indexed accesses, but technically protected members don't have quite the same issue since they're never elided, so if we wanted to we could choose to only error on access of private members on concrete types.
Fixes #60230