Whats wrong with this use of @unwrap?

In this example

I was expecting the output to be just as: “abc” but instead I am getting

as: {
NAME: “Str”,
VAL: “abc”
}

What’s wrong? Thanks

The docs say that @unwrap is only for external function arguments. Ive been hit by the same thing.
I havnt caught up with the latest language versions so things may be getting better in this area without the use of the unwrap binding. take a look at the language release notes.

You might actually be looking for @unboxed:
Variant | ReScript Language Manual

What are you trying to do?

Didn’t know it was only for external thanks. I actually was using it for writing a binding to a component. See my next reply.

@unboxed is what I use at the moment but I am curious why @unwrap doesn’t work. I was trying to write a binding to headlessui TabGroup component and was experimenting with how best to type the “as” property. The doc says it can be a string or a component Tabs - Headless UI

Then if you use it with an external, @unwrap should work. You could actually also use @unboxed in this case. Or just write two different bindings, one with string the other one with component.

I make an example to demonstrate the @unwarp issue here ReScript Playground

I think it never worked with JSX.
JSX 3 gives you an error right away: ReScript Playground

and I suppose it was never implemented for JSX4, possibly because there is now @unboxed

yes indeed, it doesn’t work with JSX because under the hood it’s not really a function parameter but an object field.

I’d recommend to use @unboxed here.

@fham and @tsnobip Thanks for the explanations.