docs: function compareSignaturesRelated(source, target, ignoreReturnTypes, reportErrors, errorReporter, compareTypes) {
              // TODO (drosen): De-duplicate code between related functions.
              if (source === target) {
                  return -1 /* True */;
              }
              if (!target.hasRestParameter && source.minArgumentCount > target.parameters.length) {
                  return 0 /* False */;
              }
              // Spec 1.0 Section 3.8.3 & 3.8.4:
              // M and N (the signatures) are instantiated using type Any as the type argument for all type parameters declared by M and N
              source = getErasedSignature(source);
              target = getErasedSignature(target);
              var result = -1 /* True */;
              var sourceThisType = getThisTypeOfSignature(source);
              if (sourceThisType && sourceThisType !== voidType) {
                  var targetThisType = getThisTypeOfSignature(target);
                  if (targetThisType) {
                      // void sources are assignable to anything.
                      var related = compareTypes(sourceThisType, targetThisType, /*reportErrors*/ false)
                          || compareTypes(targetThisType, sourceThisType, reportErrors);
                      if (!related) {
                          if (reportErrors) {
                              errorReporter(ts.Diagnostics.The_this_types_of_each_signature_are_incompatible);
                          }
                          return 0 /* False */;
                      }
                      result &= related;
                  }
              }
              var sourceMax = getNumNonRestParameters(source);
              var targetMax = getNumNonRestParameters(target);
              var checkCount = getNumParametersToCheckForSignatureRelatability(source, sourceMax, target, targetMax);
              var sourceParams = source.parameters;
              var targetParams = target.parameters;
              for (var i = 0; i < checkCount; i++) {
                  var s = i < sourceMax ? getTypeOfParameter(sourceParams[i]) : getRestTypeOfSignature(source);
                  var t = i < targetMax ? getTypeOfParameter(targetParams[i]) : getRestTypeOfSignature(target);
                  var related = compareTypes(s, t, /*reportErrors*/ false) || compareTypes(t, s, reportErrors);
                  if (!related) {
                      if (reportErrors) {
                          errorReporter(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, sourceParams[i < sourceMax ? i : sourceMax].name, targetParams[i < targetMax ? i : targetMax].name);
                      }
                      return 0 /* False */;
                  }
                  result &= related;
              }
              if (!ignoreReturnTypes) {
                  var targetReturnType = getReturnTypeOfSignature(target);
                  if (targetReturnType === voidType) {
                      return result;
                  }
                  var sourceReturnType = getReturnTypeOfSignature(source);
                  // The following block preserves behavior forbidding boolean returning functions from being assignable to type guard returning functions
                  if (target.typePredicate) {
                      if (source.typePredicate) {
                          result &= compareTypePredicateRelatedTo(source.typePredicate, target.typePredicate, reportErrors, errorReporter, compareTypes);
                      }
                      else if (ts.isIdentifierTypePredicate(target.typePredicate)) {
                          if (reportErrors) {
                              errorReporter(ts.Diagnostics.Signature_0_must_have_a_type_predicate, signatureToString(source));
                          }
                          return 0 /* False */;
                      }
                  }
                  else {
                      result &= compareTypes(sourceReturnType, targetReturnType, reportErrors);
                  }
              }
              return result;
          }