After running srb init
and srb tc
passing in a new Rails project, I installed RSpec and srb tc
now has many complaints including:
spec/spec_helper.rb:16: Unable to resolve constant RSpec https://srb.help/5002
16 |RSpec.configure do |config|
How can I resolve this error?
This is because Sorbet does not know about anything defined in a gem by default. It needs to generate an RBI file for the gem to understand the gem's constants and APIs.
When installing new gems you have to update the RBI files, which is easy with
bundle exec tapioca gem
Adding an update here, srb rbi
is deprecated in favor of tapioca
(https://github.com/Shopify/tapioca)
bundle exec tapioca init
should resolve these issues
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With