[renderers-js] Improve data enum helper when using a tuple variant with a single item
Opened this issue · 0 comments
lorisleiva commented
When a EnumTupleVariantTypeNode
contains a single item in the enum, we should transform the data enum helper such that it requires that item's value directly instead of having to wrap it in an array.
For instance, consider the following enum:
definedTypeNode({
name: 'message',
type: enumTypeNode([
enumTupleVariantTypeNode(
'write',
tupleTypeNode([numberTypeNode('u16')])
)
]),
})
Then instead of generating the following helper:
const myMessage = message('write', [42]);
We could simplify it to:
const myMessage = message('write', 42);