Skip to content

Commit a257792

Browse files
massi-angkuhe
andauthored
fix: binding the methods to the context (#1466)
* 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]>
1 parent b52b4e8 commit a257792

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.changeset/large-squids-rush.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@smithy/node-http-handler": patch
3+
---
4+
5+
Added context binding to the setTimeout and clearTimeout functions

packages/node-http-handler/src/timing.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* For test spies.
44
*/
55
export const timing = {
6-
setTimeout: setTimeout,
7-
clearTimeout: clearTimeout,
6+
setTimeout: (cb: (...ignored: any[]) => void | unknown, ms?: number) => setTimeout(cb, ms),
7+
clearTimeout: (timeoutId: string | number | undefined | unknown) =>
8+
clearTimeout(timeoutId as Parameters<typeof clearTimeout>[0]),
89
};

0 commit comments

Comments
 (0)