You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
getMessages types: Make messages in migrateMessages a read-only array.
There's no reason we'd want to mutate this array.
Given that, and the fact that we're about to make `ServerMessage` a
union of `ServerMessageOf<PmMessage>` and
`ServerMessageOf<StreamMessage>`, we might as well be courteous to
`migrateMessages`' callers by allowing them to pass an array of just
one of those types. In other words, we might as well allow this
argument, which is an array, to be treated covariantly in the type
of its elements. This is only possible when we the array is
read-only.
See discussion at
zulip#4222 (comment),
and in particular the example in "What about other types" at the
bottom of this article:
https://www.stephanboyer.com/post/132/what-are-covariance-and-contravariance.
0 commit comments