Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 1784

Problem with UltimateExpress bindings

$
0
0

It looks like ultimate-express uses a default export, rather than exporting everything by name. One way to fix the bindings would be to use @send decorators on the default value.

If you put something like this in UltimateExpress.res:

type ultimateExpressObject
@module("ultimate-express")
external ultimateExpressObject: ultimateExpressObject = "default"
...
module Router = {
  type t
  @send external rawMake: ultimateExpressObject => t = "Router"
  let make = () => rawMake(ultimateExpressObject)
  ...

and then only export make in UltimateExpress.resi:

...
module Router = {
  type t
  let make: unit => t
  ...

you’ll get the same rescript semantics while fixing the js output. (After doing likewise for the other properties, of course)


Viewing all articles
Browse latest Browse all 1784

Trending Articles