且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

有没有一种方法可以在不向每个文件中添加#类型注释的情况下使用Sorbet?

更新时间:2023-09-20 11:40:22

Sorbet支持--typed-override功能,您可以为sorbet提供一个YAML文件,以指定应将哪些文件置于哪个级别: https://github.com/sorbet/sorbet/tree/master/test/cli/override-typed . srb跑步者目前尚不知道,但是社区中一直在谈论增加对它的支持: https://sorbet-ruby.slack.com/archives/CHN2L03NH/p1563404308018500

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

请注意,根据我们在Stripe的经验,我们发现在键入的文件中包含typed: true信号具有很大的价值,因为它允许用户构建&验证他们对键入什么和不键入什么的期望.

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.