Skip to content

Commit

Permalink
chore: use more exact type in socket error handler
Browse files Browse the repository at this point in the history
This change should have no impact on functionality.

Our local TCP socket error handler was typed with an `any` parameter but
could easily be typed with an `Error` instead. This changes that.
  • Loading branch information
EvanHahn committed Sep 10, 2024
1 parent 6045f1b commit 164a114
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/discovery/local-discovery.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ export class LocalDiscovery extends TypedEmitter {
socket.off('error', this.#handleSocketError)
socket.on('error', onSocketError)

/** @param {any} e */
/** @param {Error} e */
function onSocketError(e) {
if (e.code === 'EPIPE') {
if ('code' in e && e.code === 'EPIPE') {
socket.destroy()
if (secretStream) {
secretStream.destroy()
Expand Down

0 comments on commit 164a114

Please sign in to comment.