callAsConstructor<R> method

R callAsConstructor<R>(
  1. [JSAny? arg1,
  2. JSAny? arg2,
  3. JSAny? arg3,
  4. JSAny? arg4]
)

Calls this JSFunction as a constructor with up to four arguments.

Returns the constructed object, which must be an R.

This helper doesn't allow passing nulls, as it determines whether an argument is passed based on whether it was null or not. Prefer callAsConstructorVarArgs if you need to pass nulls.

Implementation

// TODO(srujzs): The type bound should extend `JSObject`.
R callAsConstructor<R>(
        [JSAny? arg1, JSAny? arg2, JSAny? arg3, JSAny? arg4]) =>
    _callAsConstructor(arg1, arg2, arg3, arg4) as R;