mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-01 03:54:20 -05:00
Don't error when function has an implicit return but its return type is assignable to undefined (#53490)
This commit is contained in:
committed by
GitHub
parent
437fd059be
commit
c5b288487a
@@ -35658,8 +35658,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
const functionFlags = getFunctionFlags(func);
|
||||
const type = returnType && unwrapReturnType(returnType, functionFlags);
|
||||
|
||||
// Functions with an explicitly specified 'undefined, 'void' or 'any' return type don't need any return expressions.
|
||||
if (type && maybeTypeOfKind(type, TypeFlags.Undefined | TypeFlags.Void | TypeFlags.Any)) {
|
||||
// Functions with an explicitly specified 'undefined, 'void', 'any' or 'unknown' return type don't need any return expressions.
|
||||
if (type && maybeTypeOfKind(type, TypeFlags.Undefined | TypeFlags.Void | TypeFlags.Any | TypeFlags.Unknown)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user