@types/react-timeago
TypeScript icon, indicating that this package has built-in type declarations

4.1.7 • Public • Published

Installation

npm install --save @types/react-timeago

Summary

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

Details

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

index.d.ts

import * as React from "react";

declare namespace ReactTimeago {
    type Unit =
        | "second"
        | "minute"
        | "hour"
        | "day"
        | "week"
        | "month"
        | "year";

    type Suffix = "ago" | "from now";

    type Formatter = (
        value: number,
        unit: Unit,
        suffix: Suffix,
        epochMiliseconds: number,
        nextFormatter?: Formatter,
    ) => React.ReactNode;

    interface ReactTimeagoProps<T extends React.ElementType> {
        readonly live?: boolean | undefined;
        readonly minPeriod?: number | undefined;
        readonly maxPeriod?: number | undefined;
        readonly component?: T | undefined;
        readonly title?: string | undefined;
        readonly formatter?: Formatter | undefined;
        readonly date: string | number | Date;
        readonly now?: (() => number) | undefined;
    }
}

declare class ReactTimeago<
    T extends React.ElementType<P>,
    P = React.ComponentProps<T>,
> extends React.Component<
    ReactTimeago.ReactTimeagoProps<T> & P
> {}

export = ReactTimeago;

Additional Details

  • Last updated: Fri, 22 Dec 2023 00:23:24 GMT
  • Dependencies: @types/react

Credits

These definitions were written by Konstantin Lebedev, and Mike Martin.

Versions

Current Tags

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 4.1.7
    16,087
  • 4.1.6
    7,567
  • 4.1.5
    1,670
  • 4.1.4
    796
  • 4.1.3
    45,526
  • 4.1.2
    907
  • 4.1.1
    2,658
  • 4.1.0
    53

Package Sidebar

Install

npm i @types/react-timeago

Weekly Downloads

75,264

Version

4.1.7

License

MIT

Unpacked Size

5.02 kB

Total Files

5

Last publish

Collaborators

  • types