Skip to content

feat(zeitwerk): Add types for v2.8 - #1074

Merged
github-actions[bot] merged 1 commit into
ruby:mainfrom
tobidelius:zeitwerk-2.8
Sep 30, 2026
Merged

github-actions[bot] merged 1 commit into
ruby:mainfrom
tobidelius:zeitwerk-2.8

Conversation

@tobidelius

Copy link
Copy Markdown
Contributor

Adds RBS for zeitwerk, which doesn't ship its own sig/ directory.
Signatures are written against zeitwerk 2.8.3 and cover the public, documented API:

  • Zeitwerk::Loader class methods: for_gem, for_gem_extension, eager_load_all, eager_load_namespace, all_dirs, default_logger
  • Zeitwerk::Loader configuration: push_dir, dirs, tag, inflector, logger, ignore, collapse, do_not_eager_load, nsfile, enable_reloading
  • Callbacks: on_setup, on_load, on_unload
  • Lifecycle and eager loading: setup, reload, eager_load, eager_load_dir, eager_load_namespace, load_file
  • Introspection: all_expected_cpaths, cpath_expected_at
  • Inflector, GemInflector, NullInflector, and the error classes

APIs that zeitwerk marks as undocumented or experimental (unload, unregister, unloadable_cpaths, Zeitwerk.with_loader) and internals are intentionally left out.

Notes for reviewers

  • Loader#inflector returns Zeitwerk::Inflector, not the _Inflector interface, so that the documented loader.inflector.inflect(...) idiom type-checks without a cast. The setter accepts any _Inflector. This is a small trade-off in soundness when a custom inflector is assigned.
  • The value yielded to on_load/on_unload callbacks is untyped, since it's whatever class or module the file defines.

I've been using these types in my own project, so they're somewhat battle-tested.

@github-actions

Copy link
Copy Markdown

@tobidelius Thanks for your contribution!

Please follow the instructions below for each change.
See also: https://github.com/ruby/gem_rbs_collection/blob/main/docs/CONTRIBUTING.md

Available commands

You can use the following commands by commenting on this PR.

  • /merge: Merge this PR if CI passes

zeitwerk

This RBS files are newly added.

You can merge this PR immediately if the CI passes.
Just comment /merge to merge this PR.

@tobidelius

Copy link
Copy Markdown
Contributor Author

/merge

@github-actions
github-actions Bot merged commit 2d0f5ae into ruby:main Sep 30, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant