File tree 2 files changed +17
-0
lines changed
2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -262,13 +262,15 @@ function clearTimer(id: number): void {
262
262
}
263
263
264
264
export function clearTimeout ( id : number = 0 ) : void {
265
+ checkBigInt ( id ) ;
265
266
if ( id === 0 ) {
266
267
return ;
267
268
}
268
269
clearTimer ( id ) ;
269
270
}
270
271
271
272
export function clearInterval ( id : number = 0 ) : void {
273
+ checkBigInt ( id ) ;
272
274
if ( id === 0 ) {
273
275
return ;
274
276
}
Original file line number Diff line number Diff line change @@ -259,6 +259,21 @@ test(function setTimeoutShouldThrowWithBigint(): void {
259
259
assertEquals ( hasThrown , 2 ) ;
260
260
} ) ;
261
261
262
+ test ( function clearTimeoutShouldThrowWithBigint ( ) : void {
263
+ let hasThrown = 0 ;
264
+ try {
265
+ clearTimeout ( ( 1n as unknown ) as number ) ;
266
+ hasThrown = 1 ;
267
+ } catch ( err ) {
268
+ if ( err instanceof TypeError ) {
269
+ hasThrown = 2 ;
270
+ } else {
271
+ hasThrown = 3 ;
272
+ }
273
+ }
274
+ assertEquals ( hasThrown , 2 ) ;
275
+ } ) ;
276
+
262
277
test ( function testFunctionName ( ) : void {
263
278
assertEquals ( clearTimeout . name , "clearTimeout" ) ;
264
279
assertEquals ( clearInterval . name , "clearInterval" ) ;
You can’t perform that action at this time.
0 commit comments