Description
Common workflow when deserializing websocket messages from generic json objects is to cast them to the expected type:
MessageDTO<T> = {
op:string
data:T
}
interface Ping = {
msgId:string
}
const message:MessageDTO<unknown>;
if(message.op === 'PING'){
const pingMessage = message as MessageDTO<Ping>;
Casting objects to other types won't cause runtime errors and this might cause undetected bugs.
Software version
11.6.1
Description
Common workflow when deserializing websocket messages from generic json objects is to cast them to the expected type:
Casting objects to other types won't cause runtime errors and this might cause undetected bugs.
Software version
11.6.1