I have this:
const connection: WebSocketServerPacketSubscription = serverConnection?.subscribeToServerPacket("newChatMessageSent", (packet) => {
packet = packet as NewChatMessageSentPacket;
dispatch(addChatMessage(packet.message));
});
But it's saying that a type of WebSocketServerPacketSubscription | undefined can't be put into the variable, but the function doesn't return undefined, so where's it coming from?