✨ Warn about internal types used in the public API.
#2,234 opened on Jun 20, 2023
Repository metrics
- Stars
- (21,417 stars)
- PR merge metrics
- (Avg merge 10d 19h) (69 merged PRs in 30d)
Description
The internal_modules property in our gleam.toml config lets us define modules that won't be documented when generating gleam's package docs. Because gleam has no formal notion of "internal" modules, these modules can still be imported and used freely.
This is all well and good until a function in a package refers to an internal type:
pub fn with_handler(func: fn(Message, Subject(HandlerMessage)) ->
Result(Nil, Nil)) -> WebsocketHandler
Here WebsocketHandler is an internal type and so has no documentation. The DX is very poor in this case, I had to dig into the source to work out where it was coming from!
It would be great if this emitted an error the same way that using a private type in the public API does, but I'd settle for a warning too ^.^