weiroll / weiroll.js

A high-level javascript transpiler for weiroll
https://weiroll.github.io/weiroll.js/
MIT License
53 stars 10 forks source link

Handle return values from `addCommand` better #3

Closed Arachnid closed 3 years ago

Arachnid commented 3 years ago

Ideally you would be able to transparently handle functions that return 0, 1, or more return values intuitively. Eg, a function that returns one argument would look like:

const ret = planner.addCommand(contract.func(...));

and a function that returns two would look like:

const [ret1, ret2] = planner.addCommand(contract.func(...));

At the moment, however, typescript forces you to explicitly cast the result, or it complains it doesn't know which your function returns. We should fix this somehow.

Arachnid commented 3 years ago

Fixed by only allowing one return value.