AaronC81 / sord

Convert YARD docs to Sorbet RBI and Ruby 3/Steep RBS files
https://sord.aaronc.cc
MIT License
304 stars 18 forks source link

Mode to export an "externs" file instead of replacing constants? #172

Open dorner opened 1 year ago

dorner commented 1 year ago

Is your feature request related to a problem? Please describe. The PRs I've put in so far have mostly been related to Sord being able to read external files in order to avoid the "Constant not found" errors. I'm wondering what benefit we actually get from this feature. The output of sord (either RBI or RBS) are going to be fed into a type checker, which can then complain about constants that aren't found. Tapioca itself, when it reads gems, outputs a todo file that lists the constants it couldn't find rather than change the output to force you to make changes.

Describe the solution you'd like A --replace-extern mode where when Sord finds a constant it doesn't know about, it exports it to an externs file and leaves it as is in the RBI/RBS output. This way Sord doesn't even need to read in any dependencies, because it can assume that the user has those dependencies where their type checker can find them.

Does this sound like a good idea? It should be relatively easy to implement. @AaronC81