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

Bindings to a JS library with method overloads

$
0
0

I’m wrapping a JS/TS library, and everything works fine until I need to wrap a method that has an optional second argument. It starts like this:

module Graphology = {
  type directedGraph = {
    addNode: (string) => string,
    addEdge: (string, string) => string,
  }

  @new @module("graphology")
  external createDirectedGraph: unit => directedGraph = "DirectedGraph"
}

and this works. However, addNode() has an overload with an extra argument like here. What would be the way to wrap that?


Viewing all articles
Browse latest Browse all 2592

Trending Articles