CallInfo
Raw call info for variadic or dynamic-arity functions. It is available through the exact callback signature (napi.Env, napi.CallInfo) !napi.Val; neither injected value consumes a JS argument. Raw mode cannot add typed parameters or use another return type.
Methods
Prefer argsSlice: its length is min(actual argument count, max), so iterating it cannot run beyond captured storage. args remains available for existing code that needs a fixed-size array. When combining args with argCount, cap the count with @min(count, args.len).
When to use it
- Variadic functions like
sum(...nums). - Functions whose argument types depend on runtime conditions (where you would convert each argument with
val.to(env, T)based on its observed type). - Reaching
thisfrom a function that is being called as a method on a JS object.
For everything else, prefer typed parameters; the bridge does the conversion for you and the result is shorter and clearer.