In typescript, I may have a function that looks like this:
interface FooOptions {
val: number
bar?: string
}
declare function foo(options: FooOptions): unknown
I guess I want to end up with a rescript function like:
foo(~val=4, ~bar="hi", ())
I’ve seen this done with an intermediary @obj external
like foo(FooOptions.make(~val=4, ~bar="hi", ()))
Is it possible without the additional make function?
Not directly, no. You could wrap the external with a convenience function that does it for you.
1 Like
spyder
3
I believe this will land in ReScript 10 - and then records can be used.
So the ReScript call will become foo({ val:4, bar:"hi" })
just like it is in JS.