code: static final JSType getTemplateTypeOfThenable(JSTypeRegistry registry, JSType maybeThenable) {
      return maybeThenable
          // Without ".restrictByNotNullOrUndefined" we'd get the unknown type for "?IThenable<null>"
          .restrictByNotNullOrUndefined()
          .getInstantiatedTypeArgument(registry.getNativeType(JSTypeNative.I_THENABLE_TYPE));
    }
docs: If this object is known to be an IThenable, returns the type it resolves to.
  
  <p>Returns unknown otherwise.
  
  <p>(This is different from {@code getResolvedType}, which will attempt to model the then type
  of an expression after calling Promise.resolve() on it.