SupremeTechnopriest/react-idle-timer

View on GitHub
docs/pages/docs/api/types.mdx

Summary

Maintainability
Test Coverage
---
title: Types
description: Typescript types included with IdleTimer package
---

IdleTimer exports its internal types for working in Typescript projects. All the types you will need are outlined below. Examples of how to use them can be found in the [hook](/docs/api/use-idle-timer) and [higher order component](/docs/api/with-idle-timer) docs.

## IIdleTimerProps

This is the interface of the available properties IdleTimer accepts.

```js
import type { IIdleTimerProps } from 'react-idle-timer'
```

<ButtonGroup>
  <Button as='a' href='/docs/api/props'>Docs</Button>
  <Button as='a' href='https://github.com/supremetechnopriest/react-idle-timer/blob/master/src/types/IIdleTimerProps.ts'>Source</Button>
</ButtonGroup>

## IIdleTimer

This is the interface that IdleTimer exports. It consists of the methods that can be called after instantiating an IdleTimer instance.

```js
import type { IIdleTimer } from 'react-idle-timer'
```

<ButtonGroup>
  <Button href='/docs/api/methods'>Docs</Button>
  <Button href='https://github.com/supremetechnopriest/react-idle-timer/blob/master/src/types/IIdleTimer.ts'>Source</Button>
</ButtonGroup>

## ITimers

The interface that is accepted by the `timers` property.

```js
import type { ITimers } from 'react-idle-timer'
```

<ButtonGroup>
  <Button href='/docs/api/props#timers'>Docs</Button>
  <Button href='https://github.com/supremetechnopriest/react-idle-timer/blob/master/src/types/ITimers.ts'>Source</Button>
</ButtonGroup>

## EventsType

The events type contains all the valid DOM Event values that can be passed to `events` and `immediateEvents`.

```js
import type { EventsType } from 'react-idle-timer'
```

<ButtonGroup>
  <Button href='https://github.com/supremetechnopriest/react-idle-timer/blob/master/src/types/EventsType.ts'>Source</Button>
</ButtonGroup>

## MessageType

The type for messages sent through the `message()` method.

<ButtonGroup>
  <Button href='/docs/api/methods#message'>Docs</Button>
  <Button href='https://github.com/supremetechnopriest/react-idle-timer/blob/master/src/types/MessageType.ts'>Source</Button>
</ButtonGroup>

## PresenceType

The type for `onPresenceChange` state changes.

<ButtonGroup>
  <Button href='/docs/api/props#onPresenceChange'>Docs</Button>
  <Button href='https://github.com/supremetechnopriest/react-idle-timer/blob/master/src/types/PresenceType.ts'>Source</Button>
</ButtonGroup>