diff --git a/src/useIdleTimer.tsx b/src/useIdleTimer.tsx index 210c8d9..d8ac2f2 100644 --- a/src/useIdleTimer.tsx +++ b/src/useIdleTimer.tsx @@ -96,6 +96,10 @@ export function useIdleTimer ({ throw new Error(`❌ The value for the promptBeforeIdle property must fit in a 32 bit signed integer, ${MAX_TIMEOUT}.`) } + if (promptBeforeIdle >= timeout) { + throw new Error(`❌ The value for the promptBeforeIdle property be less than the timeout property, ${timeout}.`) + } + if (promptBeforeIdle) { timeoutRef.current = timeout - promptBeforeIdle promptTimeoutRef.current = promptBeforeIdle