mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
Only widen fresh literal types in CFA of assignment to auto-typed
This commit is contained in:
1 parent
0c9c76a14a
commit
728d9cb911
1 file changed
+1
-1
@@ -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