File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8389,18 +8389,11 @@ namespace ts {
83898389 }
83908390 // Given an indexed access type T[K], if T is an intersection containing one or more generic types and one or
83918391 // more mapped types with a template type `never`, '(U & V & { [P in T]: never })[K]', return a
8392- // transformed type that removes the never-mapped type: '(U & V)[K]'. This mirrors what would happen
8392+ // transformed type that removes the never-mapped type: '(U & V)[K]'. This mirrors what would happen
83938393 // eventually anyway, but it easier to reason about.
83948394 if (objectType.flags & TypeFlags.Intersection && isGenericObjectType(objectType) && some((<IntersectionType>objectType).types, isMappedTypeToNever)) {
8395- let nonNeverTypes: Type[];
8396- for (const t of (<IntersectionType>objectType).types) {
8397- if (!isMappedTypeToNever(t)) {
8398- (nonNeverTypes || (nonNeverTypes = [])).push(t);
8399- }
8400- }
8401- if (nonNeverTypes) {
8402- return getIndexedAccessType(getIntersectionType(nonNeverTypes), type.indexType);
8403- }
8395+ const nonNeverTypes = filter((<IntersectionType>objectType).types, t => !isMappedTypeToNever(t));
8396+ return getIndexedAccessType(getIntersectionType(nonNeverTypes), type.indexType);
84048397 }
84058398
84068399 // If the object type is a mapped type { [P in K]: E }, where K is generic, instantiate E using a mapper
You can’t perform that action at this time.
0 commit comments