public override JSValue Invoke(JSContext ctx, JSValue this_obj, int argc, JSValue[] argv)
        {
            if (!_ctor.IsPublic && !_type.privateAccess)
            {
                return(JSApi.JS_ThrowInternalError(ctx, "constructor is inaccessible due to its protection level"));
            }

            var nArgs = argc;
            var args  = new object[nArgs];

            for (var i = 0; i < nArgs; i++)
            {
                if (!Values.js_get_var(ctx, argv[i], _parameters[i].ParameterType, out args[i]))
                {
                    return(JSApi.JS_ThrowInternalError(ctx, "failed to cast val"));
                }
            }

            var inst = _ctor.Invoke(args);
            var val  = Values.js_new_var(ctx, this_obj, _type.type, inst, _type.id, _disposable);

            return(val);
        }