mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-16 07:13:45 -05:00
Remove object literal freshness in control flow based array types (#39518)
* Remove object literal freshness in control flow based array types * Add regression test
This commit is contained in:
@@ -20633,7 +20633,7 @@ namespace ts {
|
||||
// we defer subtype reduction until the evolving array type is finalized into a manifest
|
||||
// array type.
|
||||
function addEvolvingArrayElementType(evolvingArrayType: EvolvingArrayType, node: Expression): EvolvingArrayType {
|
||||
const elementType = getBaseTypeOfLiteralType(getContextFreeTypeOfExpression(node));
|
||||
const elementType = getRegularTypeOfObjectLiteral(getBaseTypeOfLiteralType(getContextFreeTypeOfExpression(node)));
|
||||
return isTypeSubsetOf(elementType, evolvingArrayType.elementType) ? evolvingArrayType : getEvolvingArrayType(getUnionType([evolvingArrayType.elementType, elementType]));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user