- a function need to accept objects
- but couldn't find a way to convert an JS Object to a Reason Record (holds optional value)
// I wanted to have an npm module function like below
reasonFnExposedToJs({key1: 'blah', key2: undefined})
// and works fine with Reason side but generated argsFromJs looks like below
function argsFromJs(param) {
return /* record */[
/* key1 */param.key1,
/* key2 */param.key2,
/* key3 */param.key3
];
}
// which doesn't map possible optional values
// so end up printing only first character of string since option is implemented as [something]
I made this gist to file an issue to Reason.
Now I tried the same code with Reason online editor, and it works fine, so I think it's fixed now with new version.