|
|
|
|
|
by user1988_203
1631 days ago
|
|
Can someone explain how this fits into .rbs files? Would sorbet support adding/reading types as part of .rbs files in the future. I personally find adding types inside ruby files to be unreadable. Well, this is just my personal opinion. |
|
https://sorbet.org/blog/2020/07/30/ruby-3-rbs-sorbet
tl;dr:
- RBS files are what Ruby 3 uses to describe types in separate files
- RBI files are what Sorbet uses to describe types in separate files
- Sorbet invented its RBI file syntax before RBS files existed. RBI files use the same syntax for types and signatures as in type annotations that live inside `*.rb` source code with Sorbet.
- We've been meaning to add support to Sorbet to consume both RBI files and RBS files, but we haven't had a chance to get around to it.
If someone beat us to it and implemented support for RBS files in Sorbet that would be amazing! Shopify took an early stab at implementing an RBS parser in C++ for performance[1], but I'm not sure what the status of it is today.
[1] https://github.com/Shopify/rbs_parser