Fixed an issue with reverse mapped types inference when single type variable is left after inferring from matching types#55941
Conversation
…ariable is left after inferring from matching types
| } | ||
| } | ||
| else if (target.flags & (TypeFlags.IndexedAccess | TypeFlags.Substitution)) { | ||
| if (target.flags & (TypeFlags.IndexedAccess | TypeFlags.Substitution)) { |
There was a problem hiding this comment.
preceding logic (such as the one responsible for inferring from matching types in unions here) could "reduce" the target in various ways - potentially to leaving indexed access or substitution in the target (when the target doesn't start as such). For that reason, we always need to getActualTypeVariable here as it should be called on the "reduced" target and not based on the pre-reduction flags (which sort of happened when this condition was used as just a fallback branch)
weswigham
left a comment
There was a problem hiding this comment.
Obligatory "Does this have a matching issue?", but this looks good to me. Honestly surprising if we haven't gotten any issue reports about inference failure that boil down to this, since it doesn't seem that hard to trigger.
No description provided.