Passing a delegate as a type parameter and using it throws error CS0314

If you look at https://github.com/fholm/IronJS/blob/master/Src/IronJS/Runtime.fs you'll see:

and [<AllowNullLiteral>] HostFunction<'a when 'a :> Delegate> =
  inherit FO
  val mutable Delegate : 'a

  new (env:Env, delegateFunction, metaData) =
  {
      inherit FO(env, metaData, env.Maps.Function)
      Delegate = delegateFunction
  }

In other words, you cannot use C# or VB to write your function because it requires using System.Delegate as a type constraint. I recommend either writing your function in F# or using reflection, like this:

public static FunctionObject Create<T>(CSharp.Context c, T func)
{
  // return new IronJS.HostFunction<T>(c.Environment, func, null);
  return (FunctionObject) Activator.CreateInstance(
    typeof(IronJS.Api.HostFunction<>).MakeGenericType(T),
    c.Environment, func, null);
}