mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
27 lines
819 B
TypeScript
27 lines
819 B
TypeScript
// Type definitions for use-global-hook 0.1
|
|
// Project: https://github.com/andregardi/use-global-hook#readme
|
|
// Definitions by: James Hong <https://github.com/ojameso>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
// TypeScript Version: 3.6
|
|
|
|
import React = require('react');
|
|
type ReactType = typeof React;
|
|
// to ignore strict-export-declare-modifiers error
|
|
export {};
|
|
|
|
// Where S is typeof state and A is typeof associated actions
|
|
export interface Store<S, A> {
|
|
state: S;
|
|
actions: A;
|
|
setState(state: S, afterUpdateCallback?: () => void): void;
|
|
}
|
|
|
|
export type InitializerFunction<S, A> = (store: Store<S, A>) => void;
|
|
|
|
export default function useStore<S, A>(
|
|
React: ReactType,
|
|
inititalState: S,
|
|
actions: object,
|
|
initializers?: InitializerFunction<S, A>,
|
|
): () => [S, A];
|