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
The problem is, that we T is not forwarded to the sendJsonMessage member. If we try, we get an error: Type 'SendJsonMessage' is not generic., to fix that we can change
Currently, we have this arrangement of types
react-use-websocket/src/lib/types.ts
Lines 62 to 69 in 0d9444d
The problem is, that we
T
is not forwarded to thesendJsonMessage
member. If we try, we get an error:Type 'SendJsonMessage' is not generic.
, to fix that we can changereact-use-websocket/src/lib/types.ts
Line 52 in 0d9444d
from
type SendJsonMessage = <T = unknown>(...)
totype SendJsonMessage<T = unknown> = (...)
(note the position of the=
sign).So my first question is:
sendJsonMessage: SendJsonMessage<T>
a proper fix, or should we allow different types forsendJsonMessage
andlastJsonMessage
, e.g.:(also update
useWebSocket
of course)Here's a small playground I created to test this: Playground Link
The text was updated successfully, but these errors were encountered: