mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Only widen fresh literal types in CFA of assignment to auto-typed
This commit is contained in:
@@ -20150,7 +20150,7 @@ namespace ts {
|
||||
if (isEmptyArrayAssignment(node)) {
|
||||
return getEvolvingArrayType(neverType);
|
||||
}
|
||||
const assignedType = getBaseTypeOfLiteralType(getInitialOrAssignedType(flow));
|
||||
const assignedType = getWidenedLiteralType(getInitialOrAssignedType(flow));
|
||||
return isTypeAssignableTo(assignedType, declaredType) ? assignedType : anyArrayType;
|
||||
}
|
||||
if (declaredType.flags & TypeFlags.Union) {
|
||||
|
||||
Reference in New Issue
Block a user