Skip to content

Commit 738cbe8

Browse files
authored
Update Solution.ts
1 parent 4b2b5d7 commit 738cbe8

File tree

1 file changed

+4
-3
lines changed
  • solution/2600-2699/2666.Allow One Function Call

1 file changed

+4
-3
lines changed

solution/2600-2699/2666.Allow One Function Call/Solution.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
function once<T extends (...args: any[]) => any>(
2-
fn: T,
3-
): (...args: Parameters<T>) => ReturnType<T> | undefined {
1+
type JSONValue = null | boolean | number | string | JSONValue[] | { [key: string]: JSONValue };
2+
type OnceFn = (...args: JSONValue[]) => JSONValue | undefined;
3+
4+
function once(fn: Function): OnceFn {
45
let called = false;
56
return function (...args) {
67
if (!called) {

0 commit comments

Comments
 (0)