I want to create some chalk bindings but the bindings syntax is a bit confusing when everything is nested under the same root module.
I want to use a submodule Bold containing all methods that bind to chalk.bold but I can’t figure it out how.
This is what I have so far:
@module("chalk") external red: string => string = "red" @module("chalk") external blue: string => string = "blue" @module("chalk") external green: string => string = "green" type bold @module("chalk") external bold: bold = "bold" @send external bold_yellow: (bold, string) => string = "yellow" @send external bold_cyan: (bold, string) => string = "cyan"
However this is not very ergonomic to use:
While my ideal usage would be
Which will allow things like
open Chalk.bold yellow("bla")
Not sure how can I model the correct @send inside the module