mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-18 17:27:54 -05:00
Use union types in the return type of functions in the error case
Fixes #6663
(cherry picked from commit da6e82f639)
This commit is contained in:
committed by
Bill Ticehurst
parent
671d83e81a
commit
de2ef72d4f
@@ -10433,7 +10433,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