'Sorbet: Too many arguments provided for method Proc0#call

I am trying to pass an argument to Proc0#call but Sorbet fails:

foo do |data|
  # Do stuff
end


sig { params(block: T.proc.void).void }
def foo(&block)
  x = { foo: :bar }
  block.call(x) 
end

When I run Sorbet, I see this error:

Too many arguments provided for method Proc0#call. Expected: 0, got: 1 https://srb.help/7004

How do I avoid this using strict mode?



Solution 1:[1]

Now I see it! The signature passes the param as arg0

sig {params(blk: T.proc.params(arg0: Hash).void).void}

See: https://sorbet.org/docs/procs

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Rimian