feat(zeitwerk): Add types for v2.8 - #1074
Merged
Merged
Conversation
|
@tobidelius Thanks for your contribution! Please follow the instructions below for each change. Available commandsYou can use the following commands by commenting on this PR.
|
Contributor
Author
|
/merge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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::Loaderclass methods:for_gem,for_gem_extension,eager_load_all,eager_load_namespace,all_dirs,default_loggerZeitwerk::Loaderconfiguration:push_dir,dirs,tag,inflector,logger,ignore,collapse,do_not_eager_load,nsfile,enable_reloadingon_setup,on_load,on_unloadsetup,reload,eager_load,eager_load_dir,eager_load_namespace,load_fileall_expected_cpaths,cpath_expected_atInflector,GemInflector,NullInflector, and the error classesAPIs that zeitwerk marks as undocumented or experimental (
unload,unregister,unloadable_cpaths,Zeitwerk.with_loader) and internals are intentionally left out.Notes for reviewers
Loader#inflectorreturnsZeitwerk::Inflector, not the_Inflectorinterface, so that the documentedloader.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.on_load/on_unloadcallbacks isuntyped, 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.