@wordpress/data
Version:
Data module for WordPress.
31 lines • 1.65 kB
TypeScript
/**
* Creates a data store descriptor for the provided Redux store configuration containing
* properties describing reducer, actions, selectors, controls and resolvers.
*
* @example
* ```js
* import { createReduxStore } from '@wordpress/data';
*
* const store = createReduxStore( 'demo', {
* reducer: ( state = 'OK' ) => state,
* selectors: {
* getValue: ( state ) => state,
* },
* } );
* ```
*
* @template State
* @template {Record<string,import('../../types').ActionCreator>} Actions
* @template Selectors
* @param {string} key Unique namespace identifier.
* @param {ReduxStoreConfig<State,Actions,Selectors>} options Registered store options, with properties
* describing reducer, actions, selectors,
* and resolvers.
*
* @return {StoreDescriptor<ReduxStoreConfig<State,Actions,Selectors>>} Store Object.
*/
export default function createReduxStore<State, Actions extends Record<string, any>, Selectors>(key: string, options: import("../types").ReduxStoreConfig<State, Actions, Selectors>): import("../types").StoreDescriptor<import("../types").ReduxStoreConfig<State, Actions, Selectors>>;
export type DataRegistry = import('../types').DataRegistry;
export type StoreDescriptor<C extends import("../types").AnyConfig> = import('../types').StoreDescriptor<C>;
export type ReduxStoreConfig<State, Actions extends Record<string, any>, Selectors> = import('../types').ReduxStoreConfig<State, Actions, Selectors>;
//# sourceMappingURL=index.d.ts.map