code: private void updateBind(Node n) {
      CodingConvention.Bind bind =
          compiler.getCodingConvention().describeFunctionBind(n, false, true);
      if (bind == null) {
        return;
      }
  
      Node target = bind.target;
      FunctionType callTargetFn = getJSType(target)
          .restrictByNotNullOrUndefined().toMaybeFunctionType();
      if (callTargetFn == null) {
        return;
      }
  
      if (bind.thisValue != null && target.isFunction()) {
        JSType thisType = getJSType(bind.thisValue);
        if (thisType.toObjectType() != null && !thisType.isUnknownType()
            && callTargetFn.getTypeOfThis().isUnknownType()) {
          callTargetFn =
              FunctionType.builder(registry)
                  .copyFromOtherFunction(callTargetFn)
                  .withTypeOfThis(thisType.toObjectType())
                  .build();
          target.setJSType(callTargetFn);
        }
      }
  
      n.setJSType(
          callTargetFn.getBindReturnType(
              // getBindReturnType expects the 'this' argument to be included.
              bind.getBoundParameterCount() + 1));
    }
docs: When "bind" is called on a function, we infer the type of the returned
  "bound" function by looking at the number of parameters in the call site.
  We also infer the "this" type of the target, if it's a function expression.