Skip to content

Commit

Permalink
Fix incorrect TypeScript type (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomerAberbach authored May 17, 2024
1 parent dcf1b5c commit a87ea53
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ try {
}
```
*/
export default function functionTimeout<T extends Function>(function_: T, options: Options): T; // eslint-disable-line @typescript-eslint/ban-types
export default function functionTimeout<T extends Function>(function_: T, options?: Options): T; // eslint-disable-line @typescript-eslint/ban-types

/**
Returns a boolean for whether the given error is a timeout error.
Expand Down
6 changes: 4 additions & 2 deletions index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import {expectType} from 'tsd';
import functionTimeout from './index.js';

const function_ = functionTimeout((number: number) => number * 2, {timeout: 100});
const function1_ = functionTimeout((number: number) => number * 2, {timeout: 100});
expectType<number>(function1_(2));

expectType<number>(function_(2));
const function2_ = functionTimeout((number: number) => number * 2);
expectType<number>(function2_(2));

0 comments on commit a87ea53

Please sign in to comment.