Has anyone used Sorbet in a Rails project?

I’ve been using a lot of TypeScript recently, but I’ve been waiting to try Stimulus Reflex to build something in ‘as much Ruby as possible’ but I have to admit I love the static typing and intellisense TypeScript provides. So I did some research and found Sorbet, and was wondering if anyone had actually use it (or any similar tools) to build something?

3 thoughts on “Has anyone used Sorbet in a Rails project?”

  1. I began implementation on a large project at my last job as a PoC.

    It’s really interesting, and I think the tooling is there enough to be usable, however it really does feel bolted on. If you’re greenfielding something it will be less noticable, but if you’re retrofitting you will ha e a bumpy ride, though the outcome is prob worth it.

  2. I’ve got it running on a branch on our monolith, still a work in progress. I had to downgrade to Ruby 2.6, which was a bit disappointing. The tooling is really fast.

    I also loved the Typescript experience and getting that in our complex Rails app seems hugely beneficial, especially typing all the params we end up passing around.

    The initial setup was ok but we kind of stalled when it came time to add Sorbet types for gems that extend active record, like money-rails. It certainly feels like early days for the ecosystem, and that adopting it could mean doing a lot of trailblazing.

    It caught a few subtle possible-nils which was nice, but missed a bunch of nil checks we had in place so we’ve had to add quite a few redundant T.must wrappers.

    We’re going to keep experimenting but I can’t imagine putting it live in production until we’ve created more gem types and just lived with it longer.


Leave a Comment