3 ms·
TS would require you to have attrs typed as object|null rather than object before you even got to that line if you wanted to be able to pass a null value to the
by mst 2y ago
TS would require you to have attrs typed as object|null rather than object before you even got to that line if you wanted to be able to pass a null value to the function/whatever.
It wouldn't complain about the ... usage itself because ...null is well defined and therefore not a type error.
(it would I think complain about trying to apply ... to something that isn't allowed, though I don't recall making that particular mistake yet in TS code to find out)
Though also, trivial example is trivial - I was looking for the simplest thing that was valid code and let me illustrate the general concept.