npm.io
1.1.7 • Published 10 months ago

@types/react-timeout

Licence
MIT
Version
1.1.7
Deps
1
Size
5 kB
Vulns
0
Weekly
0
Stars
51.4K

Installation

npm install --save @types/react-timeout

Summary

This package contains type definitions for react-timeout (https://github.com/plougsgaard/react-timeout).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-timeout.

index.d.ts

import * as React from "react";

export = ReactTimeout;

declare function ReactTimeout<T>(
    SourceComponent: React.ComponentClass<T> | React.FunctionComponent<T>,
): React.ComponentClass<T>;

declare namespace ReactTimeout {
    type Timer = typeof globalThis extends { setTimeout(...args: any[]): infer T } ? T : Id;
    type Immediate = typeof globalThis extends { setImmediate(...args: any[]): infer T } ? T : Id;

    type Id = number;

    interface ReactTimeoutProps {
        setTimeout?: ((callback: (...args: any[]) => void, ms: number, ...args: any[]) => Timer) | undefined;
        clearTimeout?: ((timer: Timer | Id) => void) | undefined;
        setInterval?: ((callback: (...args: any[]) => void, ms: number, ...args: any[]) => Timer) | undefined;
        clearInterval?: ((id: Timer | Id) => void) | undefined;
        setImmediate?: ((callback: (...args: any[]) => void, ...args: any[]) => Immediate) | undefined;
        clearImmediate?: ((id: Immediate | Id) => void) | undefined;
        requestAnimationFrame?: ((callback: (...args: any[]) => void) => Id) | undefined;
        cancelAnimationFrame?: ((id: Id) => void) | undefined;
    }
}

Additional Details

  • Last updated: Fri, 14 Nov 2025 1808 GMT
  • Dependencies: @types/react

Credits

These definitions were written by Kerwyn Rojas.