Recursive Modules: Binding to external libraries

I’ve been making a Discord bot in rescript and in turn have been writing a lot of bindings for DiscordJS. DiscordJS is heavy on OOP, which has made it a bit painful.

I’e run into a dependency cycle error and am curious about the best way to solve it

// GuildMember

type t
@get external getGuildMemberRoleManager: t => GuildMemberRoleManager.t = "roles"
// GuildMemberRoleManager

type t
external getGuildMember: t => GuildMember.t = "member"

As far as I can tell, the best option is flattening into one file, and then using aliases to separate modules into multiple files
Like this

Is there a better way? These bindings are rather large and it would be a shame to put it all in one file

There’s another thread that discusses a similar problem:

And worth noting that recursive module support may be removed in the future.