Skip to content

Instantly share code, notes, and snippets.

@Artur2
Created June 29, 2023 10:39
Show Gist options
  • Save Artur2/72dab52b7c0a8bd7b123c787ee455d92 to your computer and use it in GitHub Desktop.
Save Artur2/72dab52b7c0a8bd7b123c787ee455d92 to your computer and use it in GitHub Desktop.
Sorbet/Tapioca installation step by step

Installation

  1. Create Gemfile
  2. Add following gems:
gem 'sorbet', :group => :development
gem 'sorbet-runtime'
gem 'tapioca', require: false, :group => :development
  1. Run bundle install command

Generating required files for sorbet/tapioca

  1. Run bundle exec tapioca init for generating RBI files, which describe type system of installed gems
  2. To update rbi for gems run bundle exec tapioca gems for re-generating RBI files. To force regenerate RBI files, add --all flag

Using sorbet in file to provide information for LSP/etc

  1. At header of file write type declaration:
  • # typed: strict if you want all methods/props/etc have sig(signature) for static checs

  • # typed: true if you want only type errors

  • # typed: false to ignore whole file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment