Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions types/wordpress__data/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Type definitions for @wordpress/data 4.6
// Type definitions for @wordpress/data 6.0
// Project: https://github.com/WordPress/gutenberg/tree/master/packages/data/README.md
// Definitions by: Derek Sifford <https://github.com/dsifford>
// Jon Surrell <https://github.com/sirreal>
Expand All @@ -16,6 +16,7 @@ export { Action, combineReducers };
//
// Core functionality
//
export type ResolveSelectorMap = Record<string, <T = unknown>(...args: readonly any[]) => Promise<T>>;
export type SelectorMap = Record<string, <T = unknown>(...args: readonly any[]) => T>;
export type DispatcherMap = Record<string, <T = void>(...args: readonly any[]) => T>;

Expand All @@ -38,8 +39,9 @@ export type DispatcherMap = Record<string, <T = void>(...args: readonly any[]) =
*/
export type Subscriber = (callback: () => void) => () => void;

export function dispatch(key: string): DispatcherMap;
export function select(key: string): SelectorMap;
export function dispatch(storeNameOrDescriptor: string|StoreDescriptor): DispatcherMap;
export function select(storeNameOrDescriptor: string|StoreDescriptor): SelectorMap;
export function resolveSelect(storeNameOrDescriptor: string|StoreDescriptor): ResolveSelectorMap;

export const subscribe: Subscriber;

Expand Down Expand Up @@ -95,7 +97,20 @@ export interface Store<S, A extends Action = Action> {
dispatch(action: A): A;
}

export function registerGenericStore(key: string, config: GenericStoreConfig): void;
export interface StoreDescriptor {
name: string;
instantiate: (registry: DataRegistry) => GenericStoreConfig;
}

export function register(store: StoreDescriptor): void;
export function createReduxStore<T = {}>(key: string, options: StoreConfig<T>): StoreDescriptor;
/**
* @deprecated
*/
export function registerGenericStore(name: string, config: GenericStoreConfig): void;
/**
* @deprecated
*/
export function registerStore<T = {}>(key: string, config: StoreConfig<T>): Store<T>;

//
Expand Down
2 changes: 1 addition & 1 deletion types/wordpress__data/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"private": true,
"dependencies": {
"redux": "^4.0.1"
"redux": "^4.1.0"
}
}