From 33dd40bae554c0ee856f0e146602a1588f60e097 Mon Sep 17 00:00:00 2001 From: OFF0 Date: Sun, 5 Mar 2023 20:51:51 +0100 Subject: [PATCH] typescript --- src/utils/time.ts | 6 +++--- tsconfig.json | 13 ++++++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/utils/time.ts b/src/utils/time.ts index a44d035..8adf84b 100644 --- a/src/utils/time.ts +++ b/src/utils/time.ts @@ -9,8 +9,8 @@ export const bounce = ( fn: () => void, time: number, ) => { - let throttle; - let debounce; + let throttle: number | undefined; + let debounce: number | undefined; return (/*...args*/) => { if (throttle) { clearTimeout(debounce); @@ -19,7 +19,7 @@ export const bounce = ( } fn(/*...args*/); throttle = setTimeout(() => { - throttle = false; + clearTimeout(throttle); }, time); }; }; diff --git a/tsconfig.json b/tsconfig.json index 6e20659..ec17c1b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,18 @@ { "compilerOptions": { + "alwaysStrict": true, "moduleResolution": "node", + "noImplicitAny": true, + "noImplicitThis": true, + "strictBindCallApply": true, + "strictFunctionTypes": false, + "strictNullChecks": true, "target": "es2022" }, - "exclude": ["node_modules", "dist", "**/*.test.ts"] + "exclude": [ + "dist", + "esbuildconf.js", + "node_modules", + "**/*.test.ts" + ] }