Skip to content

Commit 65f8f9d

Browse files
committed
chore: update timeout references to support number type
1 parent c296d5a commit 65f8f9d

6 files changed

Lines changed: 10 additions & 10 deletions

File tree

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v22
1+
v24.14.1

src/Common/ClipboardButton/ClipboardButton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const ClipboardButton = ({
4545
size,
4646
}: ClipboardProps) => {
4747
const [copied, setCopied] = useState<boolean>(false)
48-
const setCopiedFalseTimeoutRef = useRef<ReturnType<typeof setTimeout>>(-1)
48+
const setCopiedFalseTimeoutRef = useRef<ReturnType<typeof setTimeout> | number>(-1)
4949

5050
const handleTriggerCopy = () => {
5151
setCopied(true)
@@ -90,7 +90,7 @@ export const ClipboardButton = ({
9090

9191
useEffect(
9292
() => () => {
93-
if (setCopiedFalseTimeoutRef.current > -1) {
93+
if ((setCopiedFalseTimeoutRef.current as number) > -1) {
9494
clearTimeout(setCopiedFalseTimeoutRef.current)
9595
}
9696
},

src/Common/Hooks/UseRegisterShortcut/UseRegisterShortcutProvider.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const UseRegisterShortcutProvider = ({
3636
const disableShortcutsRef = useRef<boolean>(false)
3737
const shortcutsRef = useRef<Record<string, ShortcutType>>({})
3838
const keysDownRef = useRef<Set<Uppercase<string>>>(new Set())
39-
const keyDownTimeoutRef = useRef<ReturnType<typeof setTimeout>>(-1)
39+
const keyDownTimeoutRef = useRef<ReturnType<typeof setTimeout> | number>(-1)
4040
const ignoredTags = ignoreTags ?? IGNORE_TAGS_FALLBACK
4141

4242
const registerShortcut: UseRegisterShortcutContextType['registerShortcut'] = useCallback(
@@ -113,7 +113,7 @@ const UseRegisterShortcutProvider = ({
113113

114114
keysDownRef.current.clear()
115115

116-
if (keyDownTimeoutRef.current > -1) {
116+
if ((keyDownTimeoutRef.current as number) > -1) {
117117
clearTimeout(keyDownTimeoutRef.current)
118118
keyDownTimeoutRef.current = -1
119119
}
@@ -178,7 +178,7 @@ const UseRegisterShortcutProvider = ({
178178
window.removeEventListener('keyup', handleKeyupEvent)
179179
window.removeEventListener('blur', handleBlur)
180180

181-
if (keyDownTimeoutRef.current > -1) {
181+
if ((keyDownTimeoutRef.current as number) > -1) {
182182
clearTimeout(keyDownTimeoutRef.current)
183183
}
184184
}

src/Shared/Components/BulkOperations/BulkOperations.component.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ const BulkOperations = ({
7070
try {
7171
setApiCallInProgress(true)
7272

73-
let timeout = -1
73+
let timeout: ReturnType<typeof setTimeout> | number = -1
7474

7575
const triggerUpdate = () => {
76-
if (timeout >= 0) {
76+
if ((timeout as number) >= 0) {
7777
return
7878
}
7979

src/Shared/Components/CodeEditor/Extensions/readOnlyTooltip.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ const createTooltip = (view: EditorView): Tooltip => {
7474
// Plugin to show and remove tooltip on keypress
7575
const keypressTooltipPlugin = ViewPlugin.fromClass(
7676
class {
77-
private timeoutId: number | null = null
77+
private timeoutId: ReturnType<typeof setTimeout> | number | null = null
7878

7979
constructor(public view: EditorView) {
8080
this.view.dom.addEventListener('keydown', this.handleKeyPress)

src/Shared/Components/Table/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ export type ConfigurableColumnsConfigType<
450450
> = Record<string, ConfigurableColumnsType<RowData, FilterVariant, AdditionalProps>['visibleColumns']>
451451

452452
export interface GetFilteringPromiseProps<RowData extends unknown> {
453-
searchSortTimeoutRef: React.MutableRefObject<number>
453+
searchSortTimeoutRef: React.MutableRefObject<ReturnType<typeof setTimeout> | number>
454454
callback: () => Promise<RowsType<RowData>> | RowsType<RowData>
455455
}
456456

0 commit comments

Comments
 (0)