UNPKG

ducks

Version:

🦆🦆🦆 Ducks is a Reducer Bundles Manager that Implementing the Redux Ducks Modular Proposal with Great Convenience.

62 lines 2.36 kB
/** * Ducks - https://github.com/huan/ducks * * @copyright 2020 Huan LI (李卓桓) <https://github.com/huan> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ import type { Store } from 'redux'; import type { Duck, OperationsMapObject, SelectorsMapObject } from './duck.js'; /** * Map types from a Map Object * https://github.com/microsoft/TypeScript/issues/24220#issuecomment-390063153 */ declare type BundleOperations<O extends OperationsMapObject> = { [key in keyof O]: ReturnType<O[key]>; }; declare type DucksifyOperations<D extends Duck> = BundleOperations<D extends { operations: any; } ? D['operations'] : {}>; declare type BundleSelectors<S extends SelectorsMapObject> = { [key in keyof S]: ReturnType<S[key]>; }; declare type DucksifySelectors<D extends Duck> = BundleSelectors<D extends { selectors: any; } ? D['selectors'] : {}>; declare class Bundle<D extends Duck = any> { duck: D; static VERSION: string; get store(): Store<any, import("redux").AnyAction>; private _store?; namespaces: string[]; get reducer(): D['default']; get actions(): D['actions']; get types(): D['types']; get operations(): BundleOperations<D extends { operations: any; } ? D["operations"] : {}>; get selectors(): BundleSelectors<D extends { selectors: any; } ? D["selectors"] : {}>; protected ducksifiedSelectors: DucksifySelectors<D>; protected ducksifiedOperations: DucksifyOperations<D>; protected get state(): ReturnType<D['default']>; constructor(duck: D); setStore(store: Store): void; setNamespaces(...namespaces: string[]): void; protected ducksifyOperations(duck: D): DucksifyOperations<D>; protected ducksifySelectors(duck: D): DucksifySelectors<D>; } export { Bundle, }; //# sourceMappingURL=bundle.d.ts.map