问题
I want to start using Sorbet for my Ruby on Rails project, but I've been asked not to add the type annotation to every file.
Is there a way to use Sorbet without adding the annotation?
回答1:
Sorbet supports --typed-override
feature where you can give sorbet a YAML file to specify what files should go into what level: https://github.com/sorbet/sorbet/tree/master/test/cli/override-typed.
srb
runner doesn't currently know about it, but there has been chatter in the community about adding support for it: https://sorbet-ruby.slack.com/archives/CHN2L03NH/p1563404308018500
Note that from our experience at Stripe we found that having typed: true
sigils in typed files has a lot of value as it allows users to build & verify their expectations on what is typed and what is not.
来源:https://stackoverflow.com/questions/57099664/is-there-a-way-to-use-sorbet-without-adding-the-type-annotation-to-every-file