A discriminated union representing any mouse event from either protocol.
This type combines both SGR and ESC mouse event types. The protocol property serves as a discriminant that allows TypeScript to narrow the type.
protocol
mouse.on('press', (event: MouseEvent) => { if (event.protocol === 'SGR') { // TypeScript knows this is SGRMouseEvent console.log('Using modern SGR protocol'); } else { // TypeScript knows this is ESCMouseEvent console.log('Using legacy ESC protocol'); }}); Copy
mouse.on('press', (event: MouseEvent) => { if (event.protocol === 'SGR') { // TypeScript knows this is SGRMouseEvent console.log('Using modern SGR protocol'); } else { // TypeScript knows this is ESCMouseEvent console.log('Using legacy ESC protocol'); }});
A discriminated union representing any mouse event from either protocol.
This type combines both SGR and ESC mouse event types. The
protocolproperty serves as a discriminant that allows TypeScript to narrow the type.