sorbet-rails 0.7.32 → 0.7.34
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci-master.yml +1 -1
- data/.github/workflows/ci.yml +1 -1
- data/.github/workflows/publish-gem.yml +9 -19
- data/CONTRIBUTING.md +1 -0
- data/Gemfile +4 -0
- data/README.md +1 -3
- data/Rakefile +27 -1
- data/lib/sorbet-rails/active_record_rbi_formatter.rb +4 -4
- data/lib/sorbet-rails/model_plugins/active_record_querying.rb +14 -0
- data/lib/sorbet-rails/model_rbi_formatter.rb +3 -3
- data/lib/sorbet-rails/rails_mixins/active_record_overrides.rb +1 -1
- data/lib/sorbet-rails/tasks/rails_rbi.rake +15 -0
- data/sorbet-rails.gemspec +2 -2
- data/spec/bin/run_all_specs.sh +1 -0
- data/spec/generators/rails-template.rb +2 -7
- data/spec/rails_helper.rb +2 -0
- data/spec/rake_rails_rbi_models_spec.rb +1 -1
- data/spec/support/v5.2/Gemfile.lock +76 -67
- data/spec/support/v5.2/sorbet_test_cases.rb +8 -0
- data/spec/support/v6.0/Gemfile.lock +93 -85
- data/spec/support/v6.0/sorbet_test_cases.rb +8 -0
- data/spec/support/v6.1/Gemfile +1 -1
- data/spec/support/v6.1/Gemfile.lock +115 -108
- data/spec/support/v6.1/sorbet_test_cases.rb +8 -0
- data/spec/support/v7.0/.gitattributes +7 -0
- data/spec/support/v7.0/.gitignore +35 -0
- data/spec/support/v7.0/Gemfile +48 -0
- data/spec/support/v7.0/Gemfile.lock +218 -0
- data/spec/support/v7.0/README.md +24 -0
- data/spec/support/v7.0/Rakefile +6 -0
- data/spec/support/v7.0/app/assets/images/.keep +0 -0
- data/spec/support/v7.0/app/assets/stylesheets/application.css +1 -0
- data/spec/support/v7.0/app/controllers/application_controller.rb +3 -0
- data/spec/support/v7.0/app/controllers/concerns/.keep +0 -0
- data/spec/support/v7.0/app/helpers/application_helper.rb +3 -0
- data/spec/support/v7.0/app/helpers/bar_helper.rb +3 -0
- data/spec/support/v7.0/app/helpers/baz_helper.rb +3 -0
- data/spec/support/v7.0/app/helpers/foo_helper.rb +3 -0
- data/spec/support/v7.0/app/jobs/application_job.rb +8 -0
- data/spec/support/v7.0/app/jobs/award_house_point_hourglasses.rb +12 -0
- data/spec/support/v7.0/app/mailers/application_mailer.rb +5 -0
- data/spec/support/v7.0/app/mailers/daily_prophet_mailer.rb +9 -0
- data/spec/support/v7.0/app/mailers/hogwarts_acceptance_mailer.rb +29 -0
- data/spec/support/v7.0/app/models/application_record.rb +4 -0
- data/spec/support/v7.0/app/models/concerns/.keep +0 -0
- data/spec/support/v7.0/app/models/concerns/mythical.rb +11 -0
- data/spec/support/v7.0/app/models/headmaster.rb +8 -0
- data/spec/support/v7.0/app/models/potion.rb +6 -0
- data/spec/support/v7.0/app/models/robe.rb +4 -0
- data/spec/support/v7.0/app/models/school.rb +5 -0
- data/spec/support/v7.0/app/models/spell.rb +5 -0
- data/spec/support/v7.0/app/models/spell_book.rb +18 -0
- data/spec/support/v7.0/app/models/squib.rb +6 -0
- data/spec/support/v7.0/app/models/subject.rb +5 -0
- data/spec/support/v7.0/app/models/wand.rb +19 -0
- data/spec/support/v7.0/app/models/wizard.rb +65 -0
- data/spec/support/v7.0/app/views/layouts/application.html.erb +15 -0
- data/spec/support/v7.0/app/views/layouts/mailer.html.erb +13 -0
- data/spec/support/v7.0/app/views/layouts/mailer.text.erb +1 -0
- data/spec/support/v7.0/bin/bundle +114 -0
- data/spec/support/v7.0/bin/rails +4 -0
- data/spec/support/v7.0/bin/rake +4 -0
- data/spec/support/v7.0/bin/setup +33 -0
- data/spec/support/v7.0/config/application.rb +38 -0
- data/spec/support/v7.0/config/boot.rb +4 -0
- data/spec/support/v7.0/config/database.yml +25 -0
- data/spec/support/v7.0/config/environment.rb +6 -0
- data/spec/support/v7.0/config/environments/development.rb +69 -0
- data/spec/support/v7.0/config/environments/production.rb +83 -0
- data/spec/support/v7.0/config/environments/test.rb +61 -0
- data/spec/support/v7.0/config/initializers/content_security_policy.rb +26 -0
- data/spec/support/v7.0/config/initializers/filter_parameter_logging.rb +9 -0
- data/spec/support/v7.0/config/initializers/inflections.rb +17 -0
- data/spec/support/v7.0/config/initializers/permissions_policy.rb +12 -0
- data/spec/support/v7.0/config/initializers/sorbet_rails.rb +3 -0
- data/spec/support/v7.0/config/locales/en.yml +33 -0
- data/spec/support/v7.0/config/puma.rb +44 -0
- data/spec/support/v7.0/config/routes.rb +8 -0
- data/spec/support/v7.0/config/storage.yml +34 -0
- data/spec/support/v7.0/config.ru +6 -0
- data/spec/support/v7.0/db/migrate/20190620000001_create_wizards.rb +14 -0
- data/spec/support/v7.0/db/migrate/20190620000002_create_wands.rb +12 -0
- data/spec/support/v7.0/db/migrate/20190620000003_create_spell_books.rb +10 -0
- data/spec/support/v7.0/db/migrate/20190620000004_add_more_column_types_to_wands.rb +14 -0
- data/spec/support/v7.0/db/migrate/20190620000005_add_broom_to_wizard.rb +6 -0
- data/spec/support/v7.0/db/migrate/20190620000006_add_more_enums_to_wizard.rb +9 -0
- data/spec/support/v7.0/db/migrate/20190620000007_add_type_to_wizard.rb +6 -0
- data/spec/support/v7.0/db/migrate/20190620000008_add_robe_to_wizard.rb +8 -0
- data/spec/support/v7.0/db/migrate/20190620000009_add_school.rb +10 -0
- data/spec/support/v7.0/db/migrate/20190620000010_add_subject.rb +8 -0
- data/spec/support/v7.0/db/migrate/20190620000011_add_subjects_wizards.rb +8 -0
- data/spec/support/v7.0/db/migrate/20190620000012_add_spell.rb +8 -0
- data/spec/support/v7.0/db/migrate/20190620000013_add_spells_spell_books.rb +8 -0
- data/spec/support/v7.0/db/migrate/20190620000014_create_headmasters.rb +9 -0
- data/spec/support/v7.0/db/migrate/20190620000015_add_serialized_to_wizards.rb +9 -0
- data/spec/support/v7.0/db/schema.rb +98 -0
- data/spec/support/v7.0/db/seeds.rb +8 -0
- data/spec/support/v7.0/lib/assets/.keep +0 -0
- data/spec/support/v7.0/lib/mythical_rbi_plugin.rb +16 -0
- data/spec/support/v7.0/lib/tasks/.keep +0 -0
- data/spec/support/v7.0/log/.keep +0 -0
- data/spec/support/v7.0/sorbet_test_cases.rb +439 -0
- data/spec/support/v7.0/storage/.keep +0 -0
- data/spec/support/v7.0/tmp/.keep +0 -0
- data/spec/support/v7.0/tmp/pids/.keep +0 -0
- data/spec/support/v7.0/tmp/storage/.keep +0 -0
- data/spec/support/v7.0/vendor/.keep +0 -0
- data/spec/test_data/v5.2/expected_active_record_base.rbi +6 -0
- data/spec/test_data/v5.2/expected_active_record_relation.rbi +8 -2
- data/spec/test_data/v5.2/expected_attachment.rbi +3 -3
- data/spec/test_data/v5.2/expected_blob.rbi +3 -3
- data/spec/test_data/v5.2/expected_habtm_subjects.rbi +3 -3
- data/spec/test_data/v5.2/expected_habtm_wizards.rbi +3 -3
- data/spec/test_data/v5.2/expected_headmaster.rbi +3 -3
- data/spec/test_data/v5.2/expected_internal_metadata.rbi +3 -3
- data/spec/test_data/v5.2/expected_potion.rbi +3 -3
- data/spec/test_data/v5.2/expected_robe.rbi +3 -3
- data/spec/test_data/v5.2/expected_schema_migration.rbi +3 -3
- data/spec/test_data/v5.2/expected_school.rbi +3 -3
- data/spec/test_data/v5.2/expected_spell/habtm_spell_books.rbi +3 -3
- data/spec/test_data/v5.2/expected_spell.rbi +3 -3
- data/spec/test_data/v5.2/expected_spell_book/habtm_spell_books.rbi +3 -3
- data/spec/test_data/v5.2/expected_spell_book/habtm_spells.rbi +3 -3
- data/spec/test_data/v5.2/expected_spell_book.rbi +3 -3
- data/spec/test_data/v5.2/expected_squib.rbi +3 -3
- data/spec/test_data/v5.2/expected_subject/habtm_wizards.rbi +3 -3
- data/spec/test_data/v5.2/expected_subject.rbi +3 -3
- data/spec/test_data/v5.2/expected_wand.rbi +3 -3
- data/spec/test_data/v5.2/expected_wizard/habtm_subjects.rbi +3 -3
- data/spec/test_data/v5.2/expected_wizard.rbi +3 -3
- data/spec/test_data/v5.2/expected_wizard_wo_spellbook.rbi +3 -3
- data/spec/test_data/v6.0/expected_active_record_base.rbi +6 -0
- data/spec/test_data/v6.0/expected_active_record_relation.rbi +8 -2
- data/spec/test_data/v6.0/expected_attachment.rbi +3 -3
- data/spec/test_data/v6.0/expected_blob.rbi +3 -3
- data/spec/test_data/v6.0/expected_habtm_subjects.rbi +3 -3
- data/spec/test_data/v6.0/expected_habtm_wizards.rbi +3 -3
- data/spec/test_data/v6.0/expected_headmaster.rbi +3 -3
- data/spec/test_data/v6.0/expected_internal_metadata.rbi +3 -3
- data/spec/test_data/v6.0/expected_potion.rbi +3 -3
- data/spec/test_data/v6.0/expected_robe.rbi +3 -3
- data/spec/test_data/v6.0/expected_schema_migration.rbi +3 -3
- data/spec/test_data/v6.0/expected_school.rbi +3 -3
- data/spec/test_data/v6.0/expected_spell/habtm_spell_books.rbi +3 -3
- data/spec/test_data/v6.0/expected_spell.rbi +3 -3
- data/spec/test_data/v6.0/expected_spell_book/habtm_spell_books.rbi +3 -3
- data/spec/test_data/v6.0/expected_spell_book/habtm_spells.rbi +3 -3
- data/spec/test_data/v6.0/expected_spell_book.rbi +3 -3
- data/spec/test_data/v6.0/expected_squib.rbi +3 -3
- data/spec/test_data/v6.0/expected_subject/habtm_wizards.rbi +3 -3
- data/spec/test_data/v6.0/expected_subject.rbi +3 -3
- data/spec/test_data/v6.0/expected_wand.rbi +3 -3
- data/spec/test_data/v6.0/expected_wizard/habtm_subjects.rbi +3 -3
- data/spec/test_data/v6.0/expected_wizard.rbi +3 -3
- data/spec/test_data/v6.0/expected_wizard_wo_spellbook.rbi +3 -3
- data/spec/test_data/v6.1/expected_active_record_base.rbi +6 -0
- data/spec/test_data/v6.1/expected_active_record_relation.rbi +8 -2
- data/spec/test_data/v6.1/expected_attachment.rbi +3 -3
- data/spec/test_data/v6.1/expected_blob.rbi +3 -3
- data/spec/test_data/v6.1/expected_habtm_subjects.rbi +3 -3
- data/spec/test_data/v6.1/expected_habtm_wizards.rbi +3 -3
- data/spec/test_data/v6.1/expected_headmaster.rbi +3 -3
- data/spec/test_data/v6.1/expected_internal_metadata.rbi +3 -3
- data/spec/test_data/v6.1/expected_potion.rbi +3 -3
- data/spec/test_data/v6.1/expected_record.rbi +3 -3
- data/spec/test_data/v6.1/expected_robe.rbi +3 -3
- data/spec/test_data/v6.1/expected_schema_migration.rbi +3 -3
- data/spec/test_data/v6.1/expected_school.rbi +3 -3
- data/spec/test_data/v6.1/expected_spell/habtm_spell_books.rbi +3 -3
- data/spec/test_data/v6.1/expected_spell.rbi +3 -3
- data/spec/test_data/v6.1/expected_spell_book/habtm_spell_books.rbi +3 -3
- data/spec/test_data/v6.1/expected_spell_book/habtm_spells.rbi +3 -3
- data/spec/test_data/v6.1/expected_spell_book.rbi +3 -3
- data/spec/test_data/v6.1/expected_squib.rbi +3 -3
- data/spec/test_data/v6.1/expected_subject/habtm_wizards.rbi +3 -3
- data/spec/test_data/v6.1/expected_subject.rbi +3 -3
- data/spec/test_data/v6.1/expected_variant_record.rbi +3 -3
- data/spec/test_data/v6.1/expected_wand.rbi +3 -3
- data/spec/test_data/v6.1/expected_wizard/habtm_subjects.rbi +3 -3
- data/spec/test_data/v6.1/expected_wizard.rbi +3 -3
- data/spec/test_data/v6.1/expected_wizard_wo_spellbook.rbi +3 -3
- data/spec/test_data/v7.0/expected_active_record_base.rbi +119 -0
- data/spec/test_data/v7.0/expected_active_record_relation.rbi +180 -0
- data/spec/test_data/v7.0/expected_application_job.rbi +20 -0
- data/spec/test_data/v7.0/expected_application_mailer.rbi +5 -0
- data/spec/test_data/v7.0/expected_attachment.rbi +358 -0
- data/spec/test_data/v7.0/expected_award_house_point_hourglasses.rbi +20 -0
- data/spec/test_data/v7.0/expected_blob.rbi +394 -0
- data/spec/test_data/v7.0/expected_custom_application_job.rbi +21 -0
- data/spec/test_data/v7.0/expected_custom_application_mailer.rbi +6 -0
- data/spec/test_data/v7.0/expected_custom_award_house_point_hourglasses.rbi +21 -0
- data/spec/test_data/v7.0/expected_custom_daily_prophet_mailer.rbi +8 -0
- data/spec/test_data/v7.0/expected_custom_hogwarts_acceptance_mailer.rbi +21 -0
- data/spec/test_data/v7.0/expected_daily_prophet_mailer.rbi +7 -0
- data/spec/test_data/v7.0/expected_headmaster.rbi +376 -0
- data/spec/test_data/v7.0/expected_helpers.rbi +27 -0
- data/spec/test_data/v7.0/expected_helpers_with_application_and_devise_helpers.rbi +34 -0
- data/spec/test_data/v7.0/expected_hogwarts_acceptance_mailer.rbi +20 -0
- data/spec/test_data/v7.0/expected_internal_metadata.rbi +346 -0
- data/spec/test_data/v7.0/expected_no_routes.rbi +4 -0
- data/spec/test_data/v7.0/expected_potion.rbi +328 -0
- data/spec/test_data/v7.0/expected_record.rbi +307 -0
- data/spec/test_data/v7.0/expected_robe.rbi +349 -0
- data/spec/test_data/v7.0/expected_routes.rbi +182 -0
- data/spec/test_data/v7.0/expected_schema_migration.rbi +319 -0
- data/spec/test_data/v7.0/expected_school.rbi +349 -0
- data/spec/test_data/v7.0/expected_spell/habtm_spell_books.rbi +367 -0
- data/spec/test_data/v7.0/expected_spell.rbi +340 -0
- data/spec/test_data/v7.0/expected_spell_book/habtm_spells.rbi +367 -0
- data/spec/test_data/v7.0/expected_spell_book.rbi +499 -0
- data/spec/test_data/v7.0/expected_squib.rbi +1204 -0
- data/spec/test_data/v7.0/expected_srb_tc_output.txt +1 -0
- data/spec/test_data/v7.0/expected_subject/habtm_wizards.rbi +367 -0
- data/spec/test_data/v7.0/expected_subject.rbi +340 -0
- data/spec/test_data/v7.0/expected_variant_record.rbi +382 -0
- data/spec/test_data/v7.0/expected_wand.rbi +611 -0
- data/spec/test_data/v7.0/expected_wizard/habtm_subjects.rbi +367 -0
- data/spec/test_data/v7.0/expected_wizard.rbi +1280 -0
- data/spec/test_data/v7.0/expected_wizard_wo_spellbook.rbi +1274 -0
- metadata +245 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6ae993b835bd73f18fd64cacdf0fb9f3ba8e44d8ad42cb59fa103d1f2d8a481
|
4
|
+
data.tar.gz: d47b11ca70a73985bd8e811f56fee3394960c063b8e1850470f5ff1c1202bc63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 372bb4773d316e81a5318e3749a215fec0c3c7c72dd1f363bb3c342775a93be4d82b634943d29e31552a912833ed1b3c4a4291f48acc982a9710cc28f59939b5
|
7
|
+
data.tar.gz: feaf6bcf6955f9eb9941f8f52e572c80a90a5bde285d9ccb3ec3741fad54ad51dec140dc591de041f676d26728a5c2da6b26470ed0da30b21d07b0dbe1fb2d03
|
data/.github/workflows/ci.yml
CHANGED
@@ -1,27 +1,17 @@
|
|
1
1
|
name: publish-gem
|
2
2
|
|
3
3
|
on:
|
4
|
-
|
5
|
-
push:
|
6
|
-
branches: # Trigger only on the main branch to avoid duplicate runs on PR branches
|
7
|
-
- master
|
4
|
+
workflow_dispatch:
|
8
5
|
|
9
6
|
jobs:
|
10
7
|
build:
|
11
8
|
runs-on: ubuntu-latest
|
12
|
-
|
13
|
-
env:
|
14
|
-
RAILS_VERSION: 6.0
|
15
|
-
|
16
9
|
steps:
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
uses: dawidd6/action-publish-gem@v1
|
26
|
-
with:
|
27
|
-
api_key: ${{secrets.RUBYGEMS_API_KEY}}
|
10
|
+
- uses: actions/checkout@v2
|
11
|
+
- uses: ruby/setup-ruby@v1
|
12
|
+
with:
|
13
|
+
ruby-version: 2.7
|
14
|
+
- name: Release Gem
|
15
|
+
uses: dawidd6/action-publish-gem@v1
|
16
|
+
with:
|
17
|
+
api_key: ${{secrets.RUBYGEMS_API_KEY}}
|
data/CONTRIBUTING.md
CHANGED
@@ -90,6 +90,7 @@ You can also switch to a version of Rails with `RAILS_VERSION`:
|
|
90
90
|
❯ RAILS_VERSION=5.2 ./spec/bin/run_spec.sh
|
91
91
|
❯ RAILS_VERSION=6.0 ./spec/bin/run_spec.sh
|
92
92
|
❯ RAILS_VERSION=6.1 ./spec/bin/run_spec.sh
|
93
|
+
❯ RAILS_VERSION=7.0 ./spec/bin/run_spec.sh
|
93
94
|
```
|
94
95
|
|
95
96
|
#### Debugging
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -9,8 +9,6 @@ This gem adds a few Rake tasks to generate Ruby Interface (RBI) files for dynami
|
|
9
9
|
|
10
10
|
`sorbet-rails` supports Rails 5+ or later.
|
11
11
|
|
12
|
-
**Notice**: we automatically creates a new release on Rubygems with every merges to the master branch
|
13
|
-
|
14
12
|
**Notice**: we no longer support Rails 4.2. [Version 0.5.6](https://github.com/chanzuckerberg/sorbet-rails/releases/tag/v0.5.6) is the last version supporting Rails 4.2.
|
15
13
|
|
16
14
|
## Initial Setup
|
@@ -72,7 +70,7 @@ The generation task currently creates the following signatures:
|
|
72
70
|
|
73
71
|
It is possible to add custom RBI generation logic for your custom module or gems via the plugin system. Check out the [plugins section](#extending-model-generation-task-with-custom-plugins) below if you are interested.
|
74
72
|
|
75
|
-
We also add following methods to make type-checking
|
73
|
+
We also add following methods to make type-checking easier:
|
76
74
|
- [`find_n`, `first_n`, `last_n`](https://github.com/chanzuckerberg/sorbet-rails#find-first-and-last)
|
77
75
|
- [`pluck_to_tstruct`](#pluck_to_tstruct-instead-of-pluck)
|
78
76
|
- [`typed_enum`](#typed_enum-instead-of-enum)
|
data/Rakefile
CHANGED
@@ -10,11 +10,37 @@ namespace :update_spec do
|
|
10
10
|
|
11
11
|
desc "Generate Rails apps for all versions."
|
12
12
|
task :all do |t, args|
|
13
|
+
Rake::Task['update_spec:v7_0'].invoke
|
13
14
|
Rake::Task['update_spec:v6_1'].invoke
|
14
15
|
Rake::Task['update_spec:v6_0'].invoke
|
15
16
|
Rake::Task['update_spec:v5_2'].invoke
|
16
17
|
end
|
17
18
|
|
19
|
+
desc "Delete the Rails 7.0 spec directory and regenerate it."
|
20
|
+
task :v7_0 do |t, args|
|
21
|
+
Bundler.with_clean_env do
|
22
|
+
FileUtils.rm_rf 'spec/support/v7.0' if File.directory?('spec/support/v7.0')
|
23
|
+
system("gem install rails -v 7.0.3")
|
24
|
+
system("rails _7.0.3_ -v")
|
25
|
+
command = [
|
26
|
+
"RAILS_VERSION='7.0'",
|
27
|
+
"rails _7.0.3_ new",
|
28
|
+
"--template spec/generators/rails-template.rb",
|
29
|
+
"spec/support/v7.0",
|
30
|
+
"--skip-action-cable",
|
31
|
+
"--skip-action-text",
|
32
|
+
"--skip-asset-pipeline",
|
33
|
+
"--skip-bootsnap",
|
34
|
+
"--skip-hotwire",
|
35
|
+
"--skip-javascript",
|
36
|
+
"--skip-listen",
|
37
|
+
"--skip-spring",
|
38
|
+
"--skip-test"
|
39
|
+
].join(" ")
|
40
|
+
system(command)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
18
44
|
desc "Delete the Rails 6.1 spec directory and regenerate it."
|
19
45
|
task :v6_1 do |t, args|
|
20
46
|
Bundler.with_clean_env do
|
@@ -47,7 +73,7 @@ namespace :update_spec do
|
|
47
73
|
|
48
74
|
desc "Update sorbet_test_cases.rb in all the Rails apps in spec/support."
|
49
75
|
task :sorbet_test_cases do |t, args|
|
50
|
-
['v6.1', 'v6.0', 'v5.2'].each do |version|
|
76
|
+
['v7.0', 'v6.1', 'v6.0', 'v5.2'].each do |version|
|
51
77
|
FileUtils.cp("spec/generators/sorbet_test_cases.rb", "spec/support/#{version}/sorbet_test_cases.rb")
|
52
78
|
end
|
53
79
|
end
|
@@ -40,7 +40,7 @@ class SorbetRails::ActiveRecordRbiFormatter
|
|
40
40
|
class_rbi.create_include("Enumerable")
|
41
41
|
# class_rbi.create_constant(
|
42
42
|
# "Elem",
|
43
|
-
# value: "type_member
|
43
|
+
# value: "type_member {{fixed: T.untyped}}",
|
44
44
|
# )
|
45
45
|
|
46
46
|
create_elem_specific_query_methods(class_rbi, type: 'Elem', class_method: false)
|
@@ -75,7 +75,7 @@ class SorbetRails::ActiveRecordRbiFormatter
|
|
75
75
|
parlour.root.create_class("ActiveRecord::AssociationRelation", superclass: "ActiveRecord::Relation") do |class_rbi|
|
76
76
|
class_rbi.create_constant(
|
77
77
|
"Elem",
|
78
|
-
value: "type_member
|
78
|
+
value: "type_member {{fixed: T.untyped}}",
|
79
79
|
)
|
80
80
|
|
81
81
|
# Ideally we shouldn't need to define these since this class inherits from
|
@@ -110,7 +110,7 @@ class SorbetRails::ActiveRecordRbiFormatter
|
|
110
110
|
parlour.root.create_class("ActiveRecord::Associations::CollectionProxy", superclass: "ActiveRecord::Relation") do |class_rbi|
|
111
111
|
class_rbi.create_constant(
|
112
112
|
"Elem",
|
113
|
-
value: "type_member
|
113
|
+
value: "type_member {{fixed: T.untyped}}",
|
114
114
|
)
|
115
115
|
|
116
116
|
# This _should_ work which would let us remove it from the enumerable_collections
|
@@ -220,7 +220,7 @@ class SorbetRails::ActiveRecordRbiFormatter
|
|
220
220
|
)
|
221
221
|
end
|
222
222
|
|
223
|
-
item_methods = %w(first first! second second! third third! third_to_last third_to_last! second_to_last second_to_last! last last!)
|
223
|
+
item_methods = %w(first first! second second! third third! third_to_last third_to_last! second_to_last second_to_last! last last! take take!)
|
224
224
|
item_methods.each do |item_method|
|
225
225
|
class_rbi.create_method(
|
226
226
|
item_method,
|
@@ -30,6 +30,7 @@ class SorbetRails::ModelPlugins::ActiveRecordQuerying < SorbetRails::ModelPlugin
|
|
30
30
|
:where, :rewhere, :preload, :extract_associated, :eager_load, :includes, :from, :lock, :readonly, :or,
|
31
31
|
:having, :create_with, :distinct, :references, :none, :unscope, :optimizer_hints, :merge, :except, :only,
|
32
32
|
]
|
33
|
+
|
33
34
|
model_query_relation_methods.each do |method_name|
|
34
35
|
add_relation_query_method(
|
35
36
|
root,
|
@@ -77,6 +78,19 @@ class SorbetRails::ModelPlugins::ActiveRecordQuerying < SorbetRails::ModelPlugin
|
|
77
78
|
)
|
78
79
|
end
|
79
80
|
|
81
|
+
# https://api.rubyonrails.org/v7.0.0/classes/ActiveRecord/QueryMethods.html#method-i-in_order_of
|
82
|
+
if Rails.version >= "7.0"
|
83
|
+
add_relation_query_method(
|
84
|
+
root,
|
85
|
+
"in_order_of",
|
86
|
+
parameters: [
|
87
|
+
Parameter.new("column", type: "Symbol"),
|
88
|
+
Parameter.new("values", type: "T::Array[T.untyped]")
|
89
|
+
],
|
90
|
+
builtin_query_method: true,
|
91
|
+
)
|
92
|
+
end
|
93
|
+
|
80
94
|
add_relation_query_method(
|
81
95
|
root,
|
82
96
|
"extending",
|
@@ -80,7 +80,7 @@ class SorbetRails::ModelRbiFormatter
|
|
80
80
|
model_relation_rbi.create_include(self.model_query_methods_returning_relation_module_name)
|
81
81
|
model_relation_rbi.create_constant(
|
82
82
|
"Elem",
|
83
|
-
value: "type_member
|
83
|
+
value: "type_member {{fixed: #{model_class_name}}}",
|
84
84
|
)
|
85
85
|
|
86
86
|
model_assoc_relation_rbi = root.create_class(
|
@@ -90,7 +90,7 @@ class SorbetRails::ModelRbiFormatter
|
|
90
90
|
model_assoc_relation_rbi.create_include(self.model_query_methods_returning_assoc_relation_module_name)
|
91
91
|
model_assoc_relation_rbi.create_constant(
|
92
92
|
"Elem",
|
93
|
-
value: "type_member
|
93
|
+
value: "type_member {{fixed: #{model_class_name}}}",
|
94
94
|
)
|
95
95
|
|
96
96
|
collection_proxy_rbi = root.create_class(
|
@@ -100,7 +100,7 @@ class SorbetRails::ModelRbiFormatter
|
|
100
100
|
collection_proxy_rbi.create_include(self.model_query_methods_returning_assoc_relation_module_name)
|
101
101
|
collection_proxy_rbi.create_constant(
|
102
102
|
"Elem",
|
103
|
-
value: "type_member
|
103
|
+
value: "type_member {{fixed: #{self.model_class_name}}}",
|
104
104
|
)
|
105
105
|
|
106
106
|
model_rbi = root.create_class(
|
@@ -55,7 +55,7 @@ module ::ActiveRecord::Enum
|
|
55
55
|
sig { params(definitions: T::Hash[Symbol, T.untyped]).void }
|
56
56
|
def _define_enum(definitions)
|
57
57
|
ActiveRecordOverrides.instance.store_enum_call(self, definitions)
|
58
|
-
old_enum(definitions)
|
58
|
+
old_enum(**definitions)
|
59
59
|
end
|
60
60
|
|
61
61
|
sig { params(definitions: T::Hash[Symbol, T.untyped]).void }
|
@@ -26,6 +26,9 @@ namespace :rails_rbi do
|
|
26
26
|
|
27
27
|
desc "Generate rbis for rails routes"
|
28
28
|
task :routes, [:root_dir] => :environment do |t, args|
|
29
|
+
# Skip ActionDispatch if not included
|
30
|
+
next unless defined?(ActionDispatch)
|
31
|
+
|
29
32
|
all_routes = Rails.application.routes.routes
|
30
33
|
require "action_dispatch/routing/inspector"
|
31
34
|
inspector = ActionDispatch::Routing::RoutesInspector.new(all_routes)
|
@@ -61,6 +64,9 @@ namespace :rails_rbi do
|
|
61
64
|
|
62
65
|
desc "Generate rbis for rails models. Pass models name to regenerate rbi for only the given models."
|
63
66
|
task models: :environment do |t, args|
|
67
|
+
# Skip ActiveRecord if not included
|
68
|
+
next unless defined?(ActiveRecord)
|
69
|
+
|
64
70
|
SorbetRails::Utils.rails_eager_load_all!
|
65
71
|
|
66
72
|
all_models = Set.new(ActiveRecord::Base.descendants + whitelisted_models - blacklisted_models)
|
@@ -95,6 +101,9 @@ namespace :rails_rbi do
|
|
95
101
|
|
96
102
|
desc "Generate rbis for rails helpers."
|
97
103
|
task helpers: :environment do |t, args|
|
104
|
+
# Skip ActionController if not included
|
105
|
+
next unless defined?(ActionController)
|
106
|
+
|
98
107
|
SorbetRails::Utils.rails_eager_load_all!
|
99
108
|
|
100
109
|
# API controller does not include ActionController::Helpers
|
@@ -120,6 +129,9 @@ namespace :rails_rbi do
|
|
120
129
|
|
121
130
|
desc "Generate rbis for rails mailers"
|
122
131
|
task :mailers, [:root_dir] => :environment do |t, args|
|
132
|
+
# Skip ActiveRecord if not included
|
133
|
+
next unless defined?(ActionMailer)
|
134
|
+
|
123
135
|
SorbetRails::Utils.rails_eager_load_all!
|
124
136
|
all_mailers = ActionMailer::Base.descendants
|
125
137
|
|
@@ -138,6 +150,9 @@ namespace :rails_rbi do
|
|
138
150
|
|
139
151
|
desc "Generate rbis for rails mailers"
|
140
152
|
task :jobs, [:root_dir] => :environment do |t, args|
|
153
|
+
# Skip ActiveJob if not included
|
154
|
+
next unless defined?(ActiveJob)
|
155
|
+
|
141
156
|
SorbetRails::Utils.rails_eager_load_all!
|
142
157
|
all_jobs = ActiveJob::Base.descendants
|
143
158
|
|
data/sorbet-rails.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = %q{sorbet-rails}
|
3
|
-
s.version = "0.7
|
3
|
+
s.version = "0.7.34"
|
4
4
|
s.date = %q{2019-04-18}
|
5
5
|
s.summary = %q{Set of tools to make Sorbet work with Rails seamlessly.}
|
6
6
|
s.authors = ["Chan Zuckerberg Initiative"]
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
end
|
17
17
|
|
18
18
|
s.add_dependency 'parlour', '>= 4.0.1'
|
19
|
-
s.add_dependency 'sorbet-runtime', '>= 0.5'
|
19
|
+
s.add_dependency 'sorbet-runtime', '>= 0.5.9892'
|
20
20
|
s.add_dependency 'sorbet-coerce', '>= 0.2.6'
|
21
21
|
s.add_dependency 'method_source', '>= 0.9.2'
|
22
22
|
s.add_dependency 'parser', '>= 2.7'
|
data/spec/bin/run_all_specs.sh
CHANGED
@@ -125,12 +125,6 @@ def create_models
|
|
125
125
|
end
|
126
126
|
RUBY
|
127
127
|
|
128
|
-
# A nasty hack to add has_one_attached and has_many_attached to the models/wizard.rb file.
|
129
|
-
attachments = nil
|
130
|
-
if ['5.2', '6.0', '6.1'].include?(ENV["RAILS_VERSION"])
|
131
|
-
attachments = "has_one_attached :school_photo\n has_many_attached :hats"
|
132
|
-
end
|
133
|
-
|
134
128
|
file "app/models/wizard.rb", <<~RUBY
|
135
129
|
class Wizard < ApplicationRecord
|
136
130
|
validates :name, length: { minimum: 5 }, presence: true
|
@@ -194,7 +188,8 @@ def create_models
|
|
194
188
|
belongs_to :school, optional: true
|
195
189
|
|
196
190
|
scope :recent, -> { where('created_at > ?', 1.month.ago) }
|
197
|
-
|
191
|
+
has_one_attached :school_photo
|
192
|
+
has_many_attached :hats
|
198
193
|
end
|
199
194
|
RUBY
|
200
195
|
|
data/spec/rails_helper.rb
CHANGED
@@ -1,53 +1,53 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../../..
|
3
3
|
specs:
|
4
|
-
sorbet-rails (0.7.
|
4
|
+
sorbet-rails (0.7.32)
|
5
5
|
method_source (>= 0.9.2)
|
6
6
|
parlour (>= 4.0.1)
|
7
7
|
parser (>= 2.7)
|
8
8
|
sorbet-coerce (>= 0.2.6)
|
9
|
-
sorbet-runtime (>= 0.5)
|
9
|
+
sorbet-runtime (>= 0.5.9892)
|
10
10
|
|
11
11
|
GEM
|
12
12
|
remote: https://rubygems.org/
|
13
13
|
specs:
|
14
|
-
actioncable (5.2.
|
15
|
-
actionpack (= 5.2.
|
14
|
+
actioncable (5.2.7)
|
15
|
+
actionpack (= 5.2.7)
|
16
16
|
nio4r (~> 2.0)
|
17
17
|
websocket-driver (>= 0.6.1)
|
18
|
-
actionmailer (5.2.
|
19
|
-
actionpack (= 5.2.
|
20
|
-
actionview (= 5.2.
|
21
|
-
activejob (= 5.2.
|
18
|
+
actionmailer (5.2.7)
|
19
|
+
actionpack (= 5.2.7)
|
20
|
+
actionview (= 5.2.7)
|
21
|
+
activejob (= 5.2.7)
|
22
22
|
mail (~> 2.5, >= 2.5.4)
|
23
23
|
rails-dom-testing (~> 2.0)
|
24
|
-
actionpack (5.2.
|
25
|
-
actionview (= 5.2.
|
26
|
-
activesupport (= 5.2.
|
24
|
+
actionpack (5.2.7)
|
25
|
+
actionview (= 5.2.7)
|
26
|
+
activesupport (= 5.2.7)
|
27
27
|
rack (~> 2.0, >= 2.0.8)
|
28
28
|
rack-test (>= 0.6.3)
|
29
29
|
rails-dom-testing (~> 2.0)
|
30
30
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
31
|
-
actionview (5.2.
|
32
|
-
activesupport (= 5.2.
|
31
|
+
actionview (5.2.7)
|
32
|
+
activesupport (= 5.2.7)
|
33
33
|
builder (~> 3.1)
|
34
34
|
erubi (~> 1.4)
|
35
35
|
rails-dom-testing (~> 2.0)
|
36
36
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
37
|
-
activejob (5.2.
|
38
|
-
activesupport (= 5.2.
|
37
|
+
activejob (5.2.7)
|
38
|
+
activesupport (= 5.2.7)
|
39
39
|
globalid (>= 0.3.6)
|
40
|
-
activemodel (5.2.
|
41
|
-
activesupport (= 5.2.
|
42
|
-
activerecord (5.2.
|
43
|
-
activemodel (= 5.2.
|
44
|
-
activesupport (= 5.2.
|
40
|
+
activemodel (5.2.7)
|
41
|
+
activesupport (= 5.2.7)
|
42
|
+
activerecord (5.2.7)
|
43
|
+
activemodel (= 5.2.7)
|
44
|
+
activesupport (= 5.2.7)
|
45
45
|
arel (>= 9.0)
|
46
|
-
activestorage (5.2.
|
47
|
-
actionpack (= 5.2.
|
48
|
-
activerecord (= 5.2.
|
46
|
+
activestorage (5.2.7)
|
47
|
+
actionpack (= 5.2.7)
|
48
|
+
activerecord (= 5.2.7)
|
49
49
|
marcel (~> 1.0.0)
|
50
|
-
activesupport (5.2.
|
50
|
+
activesupport (5.2.7)
|
51
51
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
52
52
|
i18n (>= 0.7, < 2)
|
53
53
|
minitest (~> 5.1)
|
@@ -59,89 +59,98 @@ GEM
|
|
59
59
|
byebug (11.1.3)
|
60
60
|
commander (4.6.0)
|
61
61
|
highline (~> 2.0.0)
|
62
|
-
concurrent-ruby (1.1.
|
62
|
+
concurrent-ruby (1.1.10)
|
63
63
|
crass (1.0.6)
|
64
64
|
erubi (1.10.0)
|
65
|
-
globalid (0.
|
66
|
-
activesupport (>=
|
65
|
+
globalid (1.0.0)
|
66
|
+
activesupport (>= 5.0)
|
67
67
|
highline (2.0.3)
|
68
|
-
i18n (1.
|
68
|
+
i18n (1.10.0)
|
69
69
|
concurrent-ruby (~> 1.0)
|
70
|
-
jbuilder (2.11.
|
70
|
+
jbuilder (2.11.5)
|
71
|
+
actionview (>= 5.0.0)
|
71
72
|
activesupport (>= 5.0.0)
|
72
|
-
loofah (2.
|
73
|
+
loofah (2.16.0)
|
73
74
|
crass (~> 1.0.2)
|
74
75
|
nokogiri (>= 1.5.9)
|
75
76
|
mail (2.7.1)
|
76
77
|
mini_mime (>= 0.1.1)
|
77
|
-
marcel (1.0.
|
78
|
+
marcel (1.0.2)
|
78
79
|
method_source (1.0.0)
|
79
|
-
mini_mime (1.1.
|
80
|
-
mini_portile2 (2.
|
81
|
-
minitest (5.
|
82
|
-
nio4r (2.5.
|
83
|
-
nokogiri (1.
|
84
|
-
mini_portile2 (~> 2.
|
80
|
+
mini_mime (1.1.2)
|
81
|
+
mini_portile2 (2.8.0)
|
82
|
+
minitest (5.15.0)
|
83
|
+
nio4r (2.5.8)
|
84
|
+
nokogiri (1.13.4)
|
85
|
+
mini_portile2 (~> 2.8.0)
|
85
86
|
racc (~> 1.4)
|
86
|
-
nokogiri (1.
|
87
|
+
nokogiri (1.13.4-x86_64-darwin)
|
87
88
|
racc (~> 1.4)
|
88
|
-
parlour (
|
89
|
+
parlour (7.0.0)
|
89
90
|
commander (~> 4.5)
|
90
91
|
parser
|
91
92
|
rainbow (~> 3.0)
|
92
93
|
sorbet-runtime (>= 0.5)
|
93
|
-
parser (3.
|
94
|
+
parser (3.1.2.0)
|
94
95
|
ast (~> 2.4.1)
|
95
96
|
polyfill (1.9.0)
|
96
97
|
puma (3.12.6)
|
97
|
-
racc (1.
|
98
|
+
racc (1.6.0)
|
98
99
|
rack (2.2.3)
|
99
100
|
rack-test (1.1.0)
|
100
101
|
rack (>= 1.0, < 3)
|
101
|
-
rails (5.2.
|
102
|
-
actioncable (= 5.2.
|
103
|
-
actionmailer (= 5.2.
|
104
|
-
actionpack (= 5.2.
|
105
|
-
actionview (= 5.2.
|
106
|
-
activejob (= 5.2.
|
107
|
-
activemodel (= 5.2.
|
108
|
-
activerecord (= 5.2.
|
109
|
-
activestorage (= 5.2.
|
110
|
-
activesupport (= 5.2.
|
102
|
+
rails (5.2.7)
|
103
|
+
actioncable (= 5.2.7)
|
104
|
+
actionmailer (= 5.2.7)
|
105
|
+
actionpack (= 5.2.7)
|
106
|
+
actionview (= 5.2.7)
|
107
|
+
activejob (= 5.2.7)
|
108
|
+
activemodel (= 5.2.7)
|
109
|
+
activerecord (= 5.2.7)
|
110
|
+
activestorage (= 5.2.7)
|
111
|
+
activesupport (= 5.2.7)
|
111
112
|
bundler (>= 1.3.0)
|
112
|
-
railties (= 5.2.
|
113
|
+
railties (= 5.2.7)
|
113
114
|
sprockets-rails (>= 2.0.0)
|
114
115
|
rails-dom-testing (2.0.3)
|
115
116
|
activesupport (>= 4.2.0)
|
116
117
|
nokogiri (>= 1.6)
|
117
|
-
rails-html-sanitizer (1.
|
118
|
+
rails-html-sanitizer (1.4.2)
|
118
119
|
loofah (~> 2.3)
|
119
|
-
railties (5.2.
|
120
|
-
actionpack (= 5.2.
|
121
|
-
activesupport (= 5.2.
|
120
|
+
railties (5.2.7)
|
121
|
+
actionpack (= 5.2.7)
|
122
|
+
activesupport (= 5.2.7)
|
122
123
|
method_source
|
123
124
|
rake (>= 0.8.7)
|
124
125
|
thor (>= 0.19.0, < 2.0)
|
125
|
-
rainbow (3.
|
126
|
+
rainbow (3.1.1)
|
126
127
|
rake (13.0.6)
|
127
128
|
safe_type (1.1.1)
|
128
|
-
sorbet (0.5.
|
129
|
-
sorbet-static (= 0.5.
|
129
|
+
sorbet (0.5.9892)
|
130
|
+
sorbet-static (= 0.5.9892)
|
130
131
|
sorbet-coerce (0.5.0)
|
131
132
|
polyfill (~> 1.8)
|
132
133
|
safe_type (~> 1.1, >= 1.1.1)
|
133
134
|
sorbet-runtime (>= 0.4.4704)
|
134
|
-
sorbet-runtime (0.5.
|
135
|
-
sorbet-static (0.5.
|
136
|
-
|
135
|
+
sorbet-runtime (0.5.9892)
|
136
|
+
sorbet-static (0.5.9892-universal-darwin-14)
|
137
|
+
sorbet-static (0.5.9892-universal-darwin-15)
|
138
|
+
sorbet-static (0.5.9892-universal-darwin-16)
|
139
|
+
sorbet-static (0.5.9892-universal-darwin-17)
|
140
|
+
sorbet-static (0.5.9892-universal-darwin-18)
|
141
|
+
sorbet-static (0.5.9892-universal-darwin-19)
|
142
|
+
sorbet-static (0.5.9892-universal-darwin-20)
|
143
|
+
sorbet-static (0.5.9892-universal-darwin-21)
|
144
|
+
sorbet-static (0.5.9892-x86_64-linux)
|
145
|
+
sprockets (4.0.3)
|
137
146
|
concurrent-ruby (~> 1.0)
|
138
147
|
rack (> 1, < 3)
|
139
|
-
sprockets-rails (3.
|
140
|
-
actionpack (>=
|
141
|
-
activesupport (>=
|
148
|
+
sprockets-rails (3.4.2)
|
149
|
+
actionpack (>= 5.2)
|
150
|
+
activesupport (>= 5.2)
|
142
151
|
sprockets (>= 3.0.0)
|
143
152
|
sqlite3 (1.4.2)
|
144
|
-
thor (1.1
|
153
|
+
thor (1.2.1)
|
145
154
|
thread_safe (0.3.6)
|
146
155
|
tzinfo (1.2.9)
|
147
156
|
thread_safe (~> 0.1)
|
@@ -171,4 +180,4 @@ DEPENDENCIES
|
|
171
180
|
web-console (>= 3.3.0)
|
172
181
|
|
173
182
|
BUNDLED WITH
|
174
|
-
2.2.
|
183
|
+
2.2.32
|
@@ -32,6 +32,8 @@ T.assert_type!(wizard.spell_book_ids, T::Array[Integer])
|
|
32
32
|
# Finder methods -- Model
|
33
33
|
T.assert_type!(Wizard.exists?(name: 'Test'), T::Boolean)
|
34
34
|
T.assert_type!(Wizard.find(wizard.id), Wizard)
|
35
|
+
T.assert_type!(Wizard.take, T.nilable(Wizard))
|
36
|
+
T.assert_type!(Wizard.take!, Wizard)
|
35
37
|
T.assert_type!(Wizard.first!, Wizard)
|
36
38
|
T.assert_type!(Wizard.first, T.nilable(Wizard))
|
37
39
|
T.assert_type!(Wizard.second!, Wizard)
|
@@ -90,6 +92,8 @@ T.assert_type!(Wizard.select_columns(:id, :name), Wizard::ActiveRecord_Relation)
|
|
90
92
|
# Finder methods -- ActiveRecord::Relation
|
91
93
|
T.assert_type!(Wizard.all.exists?(name: 'Harry Potter'), T::Boolean)
|
92
94
|
T.assert_type!(Wizard.all.find(wizard.id), Wizard)
|
95
|
+
T.assert_type!(Wizard.all.take, T.nilable(Wizard))
|
96
|
+
T.assert_type!(Wizard.all.take!, Wizard)
|
93
97
|
T.assert_type!(Wizard.all.first!, Wizard)
|
94
98
|
T.assert_type!(Wizard.all.first, T.nilable(Wizard))
|
95
99
|
T.assert_type!(Wizard.all.second!, Wizard)
|
@@ -161,6 +165,8 @@ spell_book = wizard.spell_books.first!
|
|
161
165
|
spell_books = wizard.spell_books
|
162
166
|
T.assert_type!(spell_books.exists?(name: 'Fantastic Beasts'), T::Boolean)
|
163
167
|
T.assert_type!(spell_books.find(spell_book.id), SpellBook)
|
168
|
+
T.assert_type!(spell_books.take, T.nilable(SpellBook))
|
169
|
+
T.assert_type!(spell_books.take!, SpellBook)
|
164
170
|
T.assert_type!(spell_books.first!, SpellBook)
|
165
171
|
T.assert_type!(spell_books.first, T.nilable(SpellBook))
|
166
172
|
T.assert_type!(spell_books.second!, SpellBook)
|
@@ -240,6 +246,8 @@ T.assert_type!(spell_books.push([spell_book]), SpellBook::ActiveRecord_Associati
|
|
240
246
|
spell_books_query = spell_books.where(wizard_id: wizard.id)
|
241
247
|
T.assert_type!(spell_books_query.exists?(name: 'Fantastic Beasts'), T::Boolean)
|
242
248
|
T.assert_type!(spell_books_query.find(spell_book.id), SpellBook)
|
249
|
+
T.assert_type!(spell_books_query.take, T.nilable(SpellBook))
|
250
|
+
T.assert_type!(spell_books_query.take!, SpellBook)
|
243
251
|
T.assert_type!(spell_books_query.first!, SpellBook)
|
244
252
|
T.assert_type!(spell_books_query.first, T.nilable(SpellBook))
|
245
253
|
T.assert_type!(spell_books_query.second!, SpellBook)
|