Skip to content

Don't defer resolution of indexed access types with reducible object types for writing accesses - #54689

Closed
Mateusz Burzyński (Andarist) wants to merge 3 commits into
microsoft:mainfrom
Andarist:dont-defer-indexed-access-for-writing
Closed

Mateusz Burzyński (Andarist) wants to merge 3 commits into
microsoft:mainfrom
Andarist:dont-defer-indexed-access-for-writing

Conversation

@Andarist

@Andarist Mateusz Burzyński (Andarist) commented Jun 17, 2023 •

Copy link
Copy Markdown
Contributor

fixes #54680
fixes #54834
regression from #53098

cc Anders Hejlsberg (@ahejlsberg)

@typescript-bot TypeScript Bot (typescript-bot) added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Jun 17, 2023
Comment thread tests/cases/compiler/correlatedUnions.ts
return o[k];
}

// repro from https://github.com/microsoft/TypeScript/issues/54680

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

So this regression was assessed as working as intended by Anders Hejlsberg (@ahejlsberg) here but arguably the same unsoundness can be observed in different scenarios (see here).

The new test case from #54834 doesn't manifest the same unsoundness from what I can tell though.

@weswigham Wesley Wigham (weswigham) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe just put the regressions in new test files so their variables don't have to have such funky, verbose names? I'm not a huge fan of the big omni-test files we sometimes add anyway - they're a massive pain to debug.

Otherwise, I think this is probably OK, pending a sync and verification that there are no unexpected regressions in the extended test suite.

@Andarist

Copy link
Copy Markdown
Contributor Author

Actually, this might have to be closed. Anders first assessed that this is working as intended here and later here.

I find it problematic that a different variant of this still works though (see here) and I think that both should behave in the same way (but now one error and one doesn't). Perhaps that should be reported as a bug now - so both of them would error (?).

@sandersn

Copy link
Copy Markdown
Member

Since it sounds like this is working as intended, I'm going to close it.

@github-project-automation github-project-automation Bot moved this from Waiting on author to Done in PR Backlog May 15, 2025
@microsoft Microsoft (microsoft) locked as resolved and limited conversation to collaborators Nov 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Type correlation regression Extract breaks when upgrading to TypeScript 5.1

6 participants