Is there a way to use Sorbet without adding the # type annotation to every file?

为君一笑 提交于 2020-05-29 08:47:50

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!