Given the following code:
# typed: strict
extend T::Sig
sig { params(x: T::Hash[String,String]).returns(NilClass) }
def foo(x); end
foo("foo" => 123)
I would expect Sorbet to recognize that the passed hash has the wrong value parameter. How can I properly declare a signature which will ensure the hash passed only contains allowed values types?
Unfortunately, this is a known issue in Sorbet
https://github.com/sorbet/sorbet/issues/713
You're doing everything right, and Sorbet let you down. Feel free to follow the issue, but we estimate that this particular bug will be quite hard to fix, because of some other constraints we're trying to maintain.