Interface Files for Nested modules

I’m trying to create an interface file for an implementation file that contains a nested module. Here is a distilled copy of my implementation file Foobar.res: https://rescript-lang.org/try?code=LYewJgrgNgpgBAIQIYCc4F44G8BQc4AuAngA7wEZwCWAdgTgL447FmGUBiIIcAPoqgAUyFADoCASiA

Is it possible to write Foobar.resi such that the Foobar module exposes Foobar.Bar?

Hi @lgrier

You can use a command to generate interface files:

npx  bsc -i src/Foobar.res > src/Foobar.resi

For your example it would look something like this:

// Foobar.resi

module Bar: {
  type t = int
}

type t = Foo | Bar(Bar.t)
4 Likes

thanks for the awesome information.