docs: function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) {
              if (!produceDiagnostics) {
                  return;
              }
              // Functions with with an explicitly specified 'void' or 'any' return type don't need any return expressions.
              if (returnType && maybeTypeOfKind(returnType, 1 /* Any */ | 1024 /* Void */)) {
                  return;
              }
              // If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check.
              // also if HasImplicitReturn flag is not set this means that all codepaths in function body end with return or throw
              if (ts.nodeIsMissing(func.body) || func.body.kind !== 199 /* Block */ || !functionHasImplicitReturn(func)) {
                  return;
              }
              var hasExplicitReturn = func.flags & 65536 /* HasExplicitReturn */;
              if (returnType === neverType) {
                  error(func.type, ts.Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point);
              }
              else if (returnType && !hasExplicitReturn) {
                  // minimal check: function has syntactic return type annotation and no explicit return statements in the body
                  // this function does not conform to the specification.
                  // NOTE: having returnType !== undefined is a precondition for entering this branch so func.type will always be present
                  error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value);
              }
              else if (returnType && strictNullChecks && !isTypeAssignableTo(undefinedType, returnType)) {
                  error(func.type, ts.Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined);
              }
              else if (compilerOptions.noImplicitReturns) {
                  if (!returnType) {
                      // If return type annotation is omitted check if function has any explicit return statements.
                      // If it does not have any - its inferred return type is void - don't do any checks.
                      // Otherwise get inferred return type from function body and report error only if it is not void / anytype
                      if (!hasExplicitReturn) {
                          return;
                      }
                      var inferredReturnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func));
                      if (isUnwrappedReturnTypeVoidOrAny(func, inferredReturnType)) {
                          return;
                      }
                  }
                  error(func.type || func, ts.Diagnostics.Not_all_code_paths_return_a_value);
              }
          }