-
Notifications
You must be signed in to change notification settings - Fork 13k
Revise behavior of mapped types with any
/keyof any
constraints
#61224
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
base: main
Are you sure you want to change the base?
Conversation
@jakebailey could you run tests here? I was quie surprised that almost nothing has changed in the existing tests with this change 😅 |
@typescript-bot test it |
Hey @jakebailey, the results of running the DT tests are ready. There were interesting changes: Branch only errors:Package: underscore
|
@jakebailey Here are the results of running the user tests with tsc comparing Everything looks good! |
@jakebailey Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
@jakebailey Here are the results of running the top 400 repos with tsc comparing Something interesting changed - please have a look. Details
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses issue #61203 by revising how TypeScript handles mapped types with any
and keyof any
constraints. The fix ensures that mapped types over any
properly include all valid index key types (string, number, and symbol) rather than just string keys.
- Updates the type checker logic to handle
any
types in mapped type key iteration - Modifies property name handling for mapped types with
any
constraints - Simplifies index key type determination by removing special
any
handling
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
tests/cases/conformance/types/mapped/mappedTypeWithAny.ts |
Adds test cases demonstrating the fixed behavior for mapped types with keyof any constraints |
tests/baselines/reference/mappedTypeWithAny.types |
Updates type inference baselines to show proper string/number/symbol support for keyof any |
tests/baselines/reference/mappedTypeWithAny.symbols |
Updates symbol resolution baselines for the new test cases |
tests/baselines/reference/mappedTypeWithAny.js |
Updates compiled JavaScript output baselines |
tests/baselines/reference/mappedTypeWithAny.errors.txt |
Updates error reporting baselines (no new errors expected) |
src/compiler/checker.ts |
Core compiler logic changes to properly handle any types in mapped type iteration |
fixes #61203