Skip to content

Commit

Permalink
[#285] TS: strict:true, noImplicitThis: true
Browse files Browse the repository at this point in the history
  • Loading branch information
darkwebdev committed Nov 15, 2023
1 parent c577d1e commit 747c4be
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
19 changes: 9 additions & 10 deletions src/common/debounce.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
export function debounce(fn: (any) => any, ms: number): () => void {
let timer
return () => {
clearTimeout(timer)
timer = setTimeout((...args) => {
timer = null
fn.apply(this, ...args)
}, ms)
}
}
export const debounce =
<F extends (...args: Parameters<F>) => ReturnType<F>>(fn: F, ms: number): (...args: Parameters<F>) => void => {
let timer: ReturnType<typeof setTimeout>

return (...args: Parameters<F>) => {
clearTimeout(timer)
timer = setTimeout(() => fn(...args), ms)
}
}
4 changes: 2 additions & 2 deletions src/ebay-pagination/pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ const EbayPagination: FC<PaginationProps> = ({
const debouncedUpdate = debounce(updatePages, 16)

updatePages()
window.addEventListener('resize', debouncedUpdate)
window.addEventListener('resize', () => debouncedUpdate())

return () => {
window.removeEventListener('resize', debouncedUpdate)
window.removeEventListener('resize', () => debouncedUpdate())
}
}, [children])

Expand Down
10 changes: 9 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@
"outDir": "./lib",
"declaration": true,
"declarationMap": true,
"strict": false,
"strict": true,
"strictBindCallApply": false,
"strictFunctionTypes": false,
"strictNullChecks": false,
"strictPropertyInitialization": false,
"useUnknownInCatchVariables": false,
"noImplicitAny": false,
"noImplicitThis": true,
"alwaysStrict": false,
"moduleResolution": "node",
"baseUrl": "./",
"allowSyntheticDefaultImports": true,
Expand Down

0 comments on commit 747c4be

Please sign in to comment.