Skip to content

Revert overly permissive indexed access constraints #54845

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

Merged
merged 4 commits into from
Jul 26, 2023
Merged

Conversation

ahejlsberg
Copy link
Member

Reverts #53059 and adds appropriate regression tests.

Fixes #54522.
Fixes #54837.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason this file needed to be deleted? Also, why is the baseline not removed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can keep it, though I'm not really sure what a failing test like that demonstrates.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well presumably we had no other coverage before, right? Maybe I've misunderstood.

@jcalz
Copy link
Contributor

jcalz commented Jul 26, 2023

Hope this gets merged soon, people are starting to use the lack of errors on stuff like

function what<T extends object>(t: T, k: keyof T) {    
    t[k] * 2; // no error
    JSON.parse(t[k]) // no error
}

in the wild, or at least in answering Stack Overflow questions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
Archived in project
5 participants