Skip to content

Commit

Permalink
Exclude mapped types with optionality modifiers and 'as' clauses
Browse files Browse the repository at this point in the history
  • Loading branch information
ahejlsberg committed Mar 15, 2022
1 parent 3f63804 commit 1d08203
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12219,8 +12219,11 @@ namespace ts {
}

function isMappedTypeGenericIndexedAccess(type: Type) {
return type.flags & TypeFlags.IndexedAccess && getObjectFlags((type as IndexedAccessType).objectType) & ObjectFlags.Mapped &&
!isGenericMappedType((type as IndexedAccessType).objectType) && isGenericIndexType((type as IndexedAccessType).indexType);
let objectType;
return !!(type.flags & TypeFlags.IndexedAccess && getObjectFlags(objectType = (type as IndexedAccessType).objectType) & ObjectFlags.Mapped &&
!isGenericMappedType(objectType) && isGenericIndexType((type as IndexedAccessType).indexType) &&
!(getMappedTypeModifiers(objectType as MappedType) & (MappedTypeModifiers.IncludeOptional | MappedTypeModifiers.ExcludeOptional)) &&
!(getNameTypeFromMappedType(objectType as MappedType)));
}

/**
Expand Down

0 comments on commit 1d08203

Please sign in to comment.