Shared types
Define reusable types as .rbs files in sig/shared/ (configurable via shared_type_paths):
Define reusable types as .rbs files in sig/shared/ (configurable via shared_type_paths):
# sig/shared/pagination.rbs
type pagination = {
page: Integer,
per_page: Integer,
total: Integer
}Import them in any handler:
# @rbs import pagination
# @rbs import error
# @rbs type success = {
# success: true,
# items: Array[String],
# pagination: pagination
# }
# @rbs type output = success | errorThe compiler loads sig/shared/pagination.rbs and sig/shared/error.rbs, parses their type definitions, and merges them into the handler's type map. The handler's own @rbs type definitions override on conflict.
Shared types define shapes. Authorization (@requires) stays on the handler -- it's a local policy decision, not a property of the type itself.
Collected from README.md in the repository. Edit it there, not here.