Ok this looks better
module type Foo = {
type t
}
external getFooClass: unit => module(Foo) = "getFoo"
module FooInterface = {
type t
external make: module(Foo) => module(Foo with type t = t) = "new"
@send external bar: module(Foo with type t = t) => unit = "bar"
}
let foo = getFooClass()->FooInterface.make
foo->FooInterface.bar