Skip to content

Commit

Permalink
fix: fix typescript errors due to Error
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Aug 25, 2022
1 parent f22fba2 commit 165f86d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/compat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ class Socket extends EventEmitter {
}
}
} catch (err) {
if (!this._socket.closed && err.code !== "EBUSY") {
if (!this._socket.closed && (err as {code?: string}).code !== "EBUSY") {
process.nextTick(() => this.emit("error", err))
}
}
Expand All @@ -340,7 +340,7 @@ class Socket extends EventEmitter {
if (cb) cb()
} catch (err) {
if (cb) {
cb(err)
cb(err as Error)
} else {
this.emit("error", err)
}
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ function asyncIterator<T extends SocketLikeIterable<U>, U>(this: T) {
try {
return {value: await this.receive(), done: false}
} catch (err) {
if (this.closed && err.code === "EAGAIN") {
if (this.closed && (err as {code?: string}).code === "EAGAIN") {
/* Cast so we can omit 'value: undefined'. */
return {done: true} as IteratorReturnResult<undefined>
} else {
Expand Down

0 comments on commit 165f86d

Please sign in to comment.