mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-12-12 11:50:54 -06:00
Add more comments
This commit is contained in:
parent
00f41e5693
commit
bb87332e73
@ -15516,6 +15516,10 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
else if (target.flags & TypeFlags.Intersection && some((<IntersectionType>target).types, t => !!getInferenceInfoForType(t))) {
|
||||
// We reduce intersection types only when they contain naked type parameters. For example, when
|
||||
// inferring from 'string[] & { extra: any }' to 'string[] & T' we want to remove string[] and
|
||||
// infer { extra: any } for T. But when inferring to 'string[] & Iterable<T>' we want to keep the
|
||||
// string[] on the source side and infer string for T.
|
||||
if (source.flags & TypeFlags.Intersection) {
|
||||
// Infer between identically matching source and target constituents and remove the matching types.
|
||||
const [sources, targets] = inferFromMatchingTypes((<IntersectionType>source).types, (<IntersectionType>target).types, isTypeIdenticalTo);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user