Skip to content

Commit

Permalink
fix: binding the methods to the context (#1466)
Browse files Browse the repository at this point in the history
* fix: binding the methods to the context

* fix(1465):changeset

* fix: replace bind with arrow function

* fix: types

* loosen forwarding types

---------

Co-authored-by: George Fu <[email protected]>
  • Loading branch information
massi-ang and kuhe authored Dec 6, 2024
1 parent b52b4e8 commit a257792
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/large-squids-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@smithy/node-http-handler": patch
---

Added context binding to the setTimeout and clearTimeout functions
5 changes: 3 additions & 2 deletions packages/node-http-handler/src/timing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* For test spies.
*/
export const timing = {
setTimeout: setTimeout,
clearTimeout: clearTimeout,
setTimeout: (cb: (...ignored: any[]) => void | unknown, ms?: number) => setTimeout(cb, ms),
clearTimeout: (timeoutId: string | number | undefined | unknown) =>
clearTimeout(timeoutId as Parameters<typeof clearTimeout>[0]),
};

0 comments on commit a257792

Please sign in to comment.