Fix a relationship check for partial generic mapped targets#62724
Fix a relationship check for partial generic mapped targets#62724Andarist wants to merge 3 commits intomicrosoft:mainfrom
Conversation
| const templateType = getTemplateTypeFromMappedType(target); | ||
| const modifiers = getMappedTypeModifiers(target); | ||
| if (!(modifiers & MappedTypeModifiers.ExcludeOptional)) { | ||
| const combinedOptionality = getCombinedMappedTypeOptionality(target); |
There was a problem hiding this comment.
This is an extra fix that is not needed for the original repro. I just noticed that those 2 behaved differently: WithNumber<Partial<Record<keyof T, any>>> vs Partial<WithNumber<Record<keyof T, any>>>. So to fix that ordering difference, I included this change here
| if (result = isRelatedTo(source, (nonNullComponent as IndexedAccessType).objectType, RecursionFlags.Target, reportErrors)) { | ||
| return result; | ||
| } | ||
| if (!keysRemapped && nonNullComponent.flags & TypeFlags.IndexedAccess && (nonNullComponent as IndexedAccessType).indexType === typeParameter && (result = isRelatedTo(source, (nonNullComponent as IndexedAccessType).objectType, RecursionFlags.Target, reportErrors))) { |
There was a problem hiding this comment.
this simply allows the code to take the slow path if the fast path doesnt return Ternary.True
|
@typescript-bot test it |
|
Hey @RyanCavanaugh, the results of running the DT tests are ready. Everything looks the same! |
|
@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! |
|
@RyanCavanaugh Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@RyanCavanaugh Here are the results of running the top 400 repos with tsc comparing Everything looks good! |
|
@RyanCavanaugh should #62717 be reopened, given this PR? |
|
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 #62717