Closed soberstadt closed 3 years ago
@dbenton9 those are the cached definitions of all of our gem dependencies and rails stuff (routes and other dynamic things).
For future reference, we could if we wanted to define all the method signatures in external files, but I'm not sure I want to at this point:
# typed: strict
class Buck < ApplicationRecord
sig {returns(T.nilable(String))}
attr_accessor :dept
sig {returns(String)}
def to_blob; end
sig {params(text: T.nilable(String), width: Integer).returns(String)}
def fit_text(text, width); end
private
sig {returns(Magick::ImageList)}
def build_image; end
sig {returns(Magick::ImageList)}
def bill_or_vonette; end
sig {returns(Magick::Draw)}
def text_instance; end
sig {params(text: String, width: Integer).returns(T::Boolean)}
def text_fit?(text, width); end
end
You should be able to run type checking yourself with
bundle exec srb tc
. I've also found this works really well with the sorbet-lsp extension (which I enable only in sorbet enabled workspaces).Demo of sobert finding potential "undefined method on nil":