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
Since JavaScript arrays are heterogenous, they're the canonical representation of tuples in JS. TypeScript also supports typing them, so for a homogenous array of T you might do T[], but tuples are instead of the form [T, U, V]. So a rust type Struct(U, V) maps to [U, V]. This can be represented in the IDL by adding another "variant" called "tuple", and the associated "fields" being a list of IDL types. This also creates an elegant translation of rust coproduct types, so we map
Since JavaScript arrays are heterogenous, they're the canonical representation of tuples in JS. TypeScript also supports typing them, so for a homogenous array of
T
you might doT[]
, but tuples are instead of the form[T, U, V]
. So a rust typeStruct(U, V)
maps to[U, V]
. This can be represented in the IDL by adding another"variant"
called"tuple"
, and the associated"fields"
being a list of IDL types. This also creates an elegant translation of rust coproduct types, so we mapto
IDL Example
Related to #232.
The text was updated successfully, but these errors were encountered: