We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f497490 commit 2f36455Copy full SHA for 2f36455
src/compiler/checker.ts
@@ -35687,7 +35687,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
35687
error(errorNode, Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value);
35688
}
35689
35690
- else if (type && strictNullChecks) {
+ else if (type && strictNullChecks && !isTypeAssignableTo(undefinedType, type)) {
35691
error(errorNode, Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined);
35692
35693
else if (compilerOptions.noImplicitReturns) {
0 commit comments