Sorbet: Too many arguments provided for method Proc0#call

404 views Asked by At

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?

1

There are 1 answers

1
Rimian On

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