Uh oh!
There was an error while loading. Please reload this page.
Properly propagate ObjectFlags.NonInferrableType onto non-aliased anonymous object types instantiations - #62346
Conversation
…nonymous object types instantiations
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the proper propagation of ObjectFlags.NonInferrableType onto non-aliased anonymous object type instantiations, addressing issue #62345. The fix ensures that when instantiating generic types, certain object flags (including NonInferrableType) are properly carried forward from the type arguments to the resulting instantiated type.
- Extracts propagating flags from type arguments before computing type variable containment
- Applies all propagating flags (including
NonInferrableType) to the result object type - Adds comprehensive test coverage for various scenarios where non-inferrable type propagation should occur
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/cases/compiler/nonInferrableTypePropagation4.ts | Adds test cases covering object types, type aliases, arrays, and nested structures |
| tests/baselines/reference/nonInferrableTypePropagation4.types | Expected type inference baseline showing unknown types in results |
| tests/baselines/reference/nonInferrableTypePropagation4.symbols | Expected symbol resolution baseline for the test |
| tests/baselines/reference/nonInferrableTypePropagation4.errors.txt | Expected compilation errors showing type assignment failures |
| src/compiler/checker.ts | Core fix in type instantiation logic to propagate object flags properly |
| else { | ||
| (result as ObjectFlagsType).objectFlags |= !resultCouldContainTypeVariables ? ObjectFlags.CouldContainTypeVariablesComputed : 0; | ||
| if (result.flags & TypeFlags.ObjectFlagsType) { | ||
| let propagatingFlags = getPropagatingFlagsOfTypes(typeArguments); |
There was a problem hiding this comment.
Propagating from typeArguments is the core of the fix, the rest is just adjusted indentation.
You can also find some prior related discussion here: #49887 (comment)
Ryan Cavanaugh (RyanCavanaugh)
commented
Aug 27, 2025
TypeScript Bot (@typescript-bot) test it |
TypeScript Bot (typescript-bot)
commented
Aug 27, 2025
Hey Ryan Cavanaugh (@RyanCavanaugh), the results of running the DT tests are ready. Everything looks the same! |
TypeScript Bot (typescript-bot)
commented
Aug 27, 2025
Ryan Cavanaugh (@RyanCavanaugh) Here are the results of running the user tests with tsc comparing There were infrastructure failures potentially unrelated to your change:
Otherwise... Everything looks good! |
TypeScript Bot (typescript-bot)
commented
Aug 27, 2025
Ryan Cavanaugh (@RyanCavanaugh) Here they are:tscComparison Report - baseline..pr
System info unknown Hosts
Scenarios
Developer Information: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
TypeScript Bot (typescript-bot)
commented
Aug 27, 2025
Ryan Cavanaugh (@RyanCavanaugh) Here are the results of running the top 400 repos with tsc comparing Everything looks good! |
…-anonymous-object-types
Ryan Cavanaugh (RyanCavanaugh)
commented
Nov 5, 2025
TypeScript Bot (@typescript-bot) pack this |
TypeScript Bot (typescript-bot)
commented
Nov 5, 2025
Hey Ryan Cavanaugh (@RyanCavanaugh), I've packed this into an installable tgz. You can install it for testing by referencing it in your and then running |
…-anonymous-object-types
TypeScript Bot (typescript-bot)
commented
Mar 24, 2026
With 6.0 out as the final release vehicle for this codebase, we're closing all PRs that don't fit the merge criteria for post-6.0 patches. If you think this was a mistake and this PR fits the post-6.0 patch criteria, please post to the 6.0 iteration issue with details (specifically, which PR and which patch criteria it satisfies). Next steps for PRs:
|
fixes#62345