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

1.0.2 • Public • Published

Installation

npm install --save @types/use-subscription

Summary

This package contains type definitions for use-subscription (https://github.com/facebook/react/).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/use-subscription.

index.d.ts

export type Unsubscribe = () => void;

export interface Subscription<T> {
    /**
     * (Synchronously) returns the current value of our subscription.
     */
    getCurrentValue: () => T;
    /**
     * This function is passed an event handler to attach to the subscription.
     * It must return an unsubscribe function that removes the handler.
     */
    subscribe: (callback: () => void) => Unsubscribe;
}

export function useSubscription<T>(subscription: Subscription<T>): T;

Additional Details

  • Last updated: Tue, 07 Nov 2023 15:11:36 GMT
  • Dependencies: none

Credits

These definitions were written by Sebastian Silbermann.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/use-subscription

Weekly Downloads

31,422

Version

1.0.2

License

MIT

Unpacked Size

3.57 kB

Total Files

5

Last publish

Collaborators

  • types