gleam-lang/gleam

✨ Warn about internal types used in the public API.

Open

#2,234 opened on Jun 20, 2023

View on GitHub
 (9 comments) (3 reactions) (0 assignees)Rust (21,417 stars) (960 forks)batch import
good first issuehelp wanted

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 ^.^

Contributor guide