In TypeScript I am trying to read the value of a stateful variable (created with React.useState) from within a WebSocket\'s onmessage function. The value is only ever read a