Open HoneyryderChuck opened 6 months ago
Destructively updating type of something is not supported in Steep. It's a bit different from type narrowing with nil?
, because it should be propagated to outer context, for example method caller context.
def foo(arr)
arr.delete(:sym)
end
arr = [1, :sym]
foo arr
Just read that typescript will support smth of the kind in 5.5
Given an array
arr
typed asArray[Integer | :sym]
, given a call such asarr.delete(:sym)
, the type should be updated toArray[Integer]
, similar to the type narrowing performed by.nil?
calls.