mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-18 17:27:54 -05:00
Exclude mapped types with optionality modifiers and 'as' clauses from constraint logic (#48273)
* Exclude mapped types with optionality modifiers and 'as' clauses * Add regression tests
This commit is contained in:
@@ -12219,9 +12219,10 @@ namespace ts {
|
||||
}
|
||||
|
||||
function isMappedTypeGenericIndexedAccess(type: Type) {
|
||||
return type.flags & TypeFlags.IndexedAccess && getObjectFlags((type as IndexedAccessType).objectType) & ObjectFlags.Mapped &&
|
||||
!((type as IndexedAccessType).objectType as MappedType).declaration.nameType &&
|
||||
!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) &&
|
||||
!(objectType as MappedType).declaration.questionToken && !(objectType as MappedType).declaration.nameType);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user