Closed jigarius closed 3 years ago
Does no_commands
work if you remove the sig
call?
Yes. I've temporarily removed the sig
to tackle the issue. However, removing the sig
makes that method lose typing info for it's arguments.
I don't think there is something we can do here. Sorbet is removing the method you defined and adding it with the same name and different implementation to check types at runtime. This means that the method defined by Sorbet, not the method defined by you, is defined outside of the no_commands
block.
You could try remove_command
like documented in the no_commands
method, but I'm not sure if that would work either.
Looking into the code the no_commands
should only be required for public methods. If you define a private method outside of the no_commands
block, with a sig, does it work?
I already tried using remove_command
, but that didn't help. Also, I continue to get the error even if the input_choice
method is under private
.
I'll try asking the Sorbet team if they have any suggested workarounds for these kind of things. I'm closing the issue for now. Thanks for the fast responses.
@jigarius 👋 Did you find any workarounds?
I'm working on a small CLI app where I'm using Thor. I have a helper method in my Cli class like this:
Despite using
no_commands
, I keep getting a warning:Maybe Thor is not compatible with Sorbet? I was wondering if there's another way to indicate that a method is not a command? Maybe something like: