-
Notifications
You must be signed in to change notification settings - Fork 227
Open
Description
We (at Datadog) stumble upon situation when we use Hash#transform_values! and we get into the trap of type-locking introduced in this PR #728
What do you think of making both mutation methods have the same signature, like this one (taken from the original transform_values)?
def transform_values: () -> Enumerator[V, Hash[K, untyped]]
| [A] () { (V) -> A } -> Hash[K, A]
Because now there is no way to change the type of say, this expression (response is Net::HTTPResponse)
response.to_hash.transform_values! { |value| Array(value).join }
when run Steep it will complain that original Hash typed as Hash[String, Array[String]] and if something expects to get Hash[String, String] the check will fail, but in fact we mutate the value to be a String.
Metadata
Metadata
Assignees
Labels
No labels