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.