You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's say a JS function must accept a variadic arguments of Node as input, ...nodes.
We have 2 solutions to handle this on the native API:
use the built-in slice, ie. []Node
use a custom generated type, VariadicNodes generated through a provided helper function Variadic(comptime T: type) type
The slice solution is easier to use as you don't have to generate the Variadic<Type>. But it's also less explicit and can lead to some misunderstanding:
it's not a JS Array as the semantics might make you think (see Handle JS Array #52)
the Native -> JS translation will not be possible, therefore returning []Node will be forbidden, which is less obvious than forbid to return a VariadicNode
The text was updated successfully, but these errors were encountered:
Let's say a JS function must accept a variadic arguments of
Node
as input,...nodes
.We have 2 solutions to handle this on the native API:
[]Node
VariadicNodes
generated through a provided helper functionVariadic(comptime T: type) type
The slice solution is easier to use as you don't have to generate the
Variadic<Type>
. But it's also less explicit and can lead to some misunderstanding:[]Node
will be forbidden, which is less obvious than forbid to return aVariadicNode
The text was updated successfully, but these errors were encountered: