mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 01:04:49 -05:00
Merge pull request #6699 from RyanCavanaugh/fix6663
Use union types in the return type of functions in the error case
This commit is contained in:
@@ -10421,7 +10421,8 @@ namespace ts {
|
||||
}
|
||||
else {
|
||||
error(func, Diagnostics.No_best_common_type_exists_among_return_expressions);
|
||||
return unknownType;
|
||||
// Defer to unioning the return types so we get a) downstream errors earlier and b) better Salsa experience
|
||||
return getUnionType(types);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user