@rematch/select
Advanced tools
Comparing version 3.0.1 to 3.1.0
@@ -6,2 +6,14 @@ # Change Log | ||
# [3.1.0](https://github.com/rematch/rematch/compare/@rematch/select@3.0.1...@rematch/select@3.1.0) (2021-08-13) | ||
### Bug Fixes | ||
* build to modules to .mjs instead of .js and sideEffects: false for better treeshaking ([c2978f3](https://github.com/rematch/rematch/commit/c2978f3087f8283249f69b60c569720e56091c36)) | ||
* updated peerDependencies ([#898](https://github.com/rematch/rematch/issues/898)) ([3013605](https://github.com/rematch/rematch/commit/30136054a9c7d2f1b4215e66e2e4065314f841eb)) | ||
## [3.0.1](https://github.com/rematch/rematch/compare/@rematch/select@3.0.0...@rematch/select@3.0.1) (2021-02-23) | ||
@@ -8,0 +20,0 @@ |
import { Models, Plugin } from '@rematch/core'; | ||
import { SelectConfig } from './types'; | ||
declare const createSelectPlugin: <TModels extends Models<TModels>, TExtraModels extends Models<TModels> = Record<string, any>>(config?: SelectConfig<TModels>) => Plugin<TModels, TExtraModels, Partial<TExtraModels>>; | ||
declare const createSelectPlugin: <TModels extends Models<TModels>, TExtraModels extends Models<TModels> = Record<string, any>>(config?: SelectConfig<TModels, TExtraModels>) => Plugin<TModels, TExtraModels, Partial<TExtraModels>>; | ||
export default createSelectPlugin; | ||
export * from './types'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -8,3 +8,3 @@ <div align="center"> | ||
[![Chat on slack](https://img.shields.io/badge/slack-rematchjs-blue.svg?logo=slack&style=flat-square)](https://rematchjs.slack.com) ![Rematch CI](https://github.com/rematch/rematch/workflows/Rematch%20CI/badge.svg?branch=main) [![Bundle size](https://img.shields.io/bundlephobia/minzip/@rematch/core?style=flat-square)](https://img.shields.io/badge/bundlesize-~5kb-brightgreen.svg?style=flat-square) [![File size](https://img.shields.io/badge/dependencies-redux-brightgreen.svg?style=flat-square)](https://img.shields.io/badge/dependencies-redux-brightgreen.svg?style=flat-square) [![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg?style=flat-square)](https://lerna.js.org/) [![https://img.shields.io/lgtm/grade/javascript/github/rematch/rematch?logo=typescript](https://img.shields.io/lgtm/grade/javascript/github/rematch/rematch?logo=typescript)](https://lgtm.com/projects/g/rematch/rematch?mode=list) [![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/from-referrer/) | ||
[![Chat on Discord](https://img.shields.io/badge/discord-rematch-purple.svg?logo=discord&style=flat-square)](https://discord.gg/zMzsMGvEHk) ![Rematch CI](https://github.com/rematch/rematch/workflows/Rematch%20CI/badge.svg?branch=main) [![Bundle size](https://img.shields.io/bundlephobia/minzip/@rematch/core?style=flat-square)](https://img.shields.io/badge/bundlesize-~5kb-brightgreen.svg?style=flat-square) [![File size](https://img.shields.io/badge/dependencies-redux-brightgreen.svg?style=flat-square)](https://img.shields.io/badge/dependencies-redux-brightgreen.svg?style=flat-square) [![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg?style=flat-square)](https://lerna.js.org/) [![https://img.shields.io/lgtm/grade/javascript/github/rematch/rematch?logo=typescript](https://img.shields.io/lgtm/grade/javascript/github/rematch/rematch?logo=typescript)](https://lgtm.com/projects/g/rematch/rematch?mode=list) [![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/from-referrer/) | ||
@@ -11,0 +11,0 @@ |
@@ -6,36 +6,36 @@ import { ExtractRematchStateFromModels, Models, Model, Action, RematchRootState, ModelReducers, ModelEffects, ModelEffectsCreator } from '@rematch/core'; | ||
export declare type Selector<TState, TReturns, TProps = void> = TProps extends void ? (state: TState) => TReturns : (state: TState, props: TProps) => TReturns; | ||
export declare type ExtractSelectorsFromModel<TModels extends Models<TModels> = Record<string, any>, TModel extends Model<TModels> = Model<TModels>> = TModel['selectors'] extends (...args: any[]) => infer TReturnObj ? TReturnObj : TModel['selectors'] extends Record<string, any> ? TModel['selectors'] : never; | ||
export declare type ExtractSelectorsFromModel<TModels extends Models<TModels>, TModel extends Model<TModels>> = TModel['selectors'] extends (...args: any[]) => infer TReturnObj ? TReturnObj : TModel['selectors'] extends Record<string, any> ? TModel['selectors'] : never; | ||
export declare type ExtractSelectorsSignatureFromSelectorsModel<TRootState, TSelectorsConfigObject, TKey extends keyof TSelectorsConfigObject> = TSelectorsConfigObject[TKey] extends (...args: any[]) => infer TSelector ? TSelector extends (props: infer TProps) => Selector<any, infer TReturns> ? (props: TProps) => Selector<TRootState, TReturns> : TSelector extends Selector<any, infer TReturns> ? Selector<TRootState, TReturns> : TSelector extends Selector<any, infer TReturns, infer TProps> ? Selector<TRootState, TReturns, TProps> : never : never; | ||
export interface SelectConfig<TModels extends Models<TModels> = Record<string, any>> { | ||
sliceState?: (state: ExtractRematchStateFromModels<TModels>, model: Model<TModels>) => Record<string, any> | undefined; | ||
export interface SelectConfig<TModels extends Models<TModels>, TExtraModels extends Models<TModels>> { | ||
sliceState?: (state: ExtractRematchStateFromModels<TModels, TExtraModels>, model: Model<TModels>) => Record<string, any> | undefined; | ||
selectorCreator?: any; | ||
} | ||
export declare type ModelSelectors<TModels extends Models<TModels> = Record<string, any>, TModel extends Model<TModels> = Model<TModels>> = { | ||
[key in keyof ExtractSelectorsFromModel<TModels, TModel>]: ExtractSelectorsSignatureFromSelectorsModel<RematchRootState<TModels>, ExtractSelectorsFromModel<TModels, TModel>, key>; | ||
export declare type ModelSelectors<TModels extends Models<TModels>, TExtraModels extends Models<TModels>, TModel extends Model<TModels>> = { | ||
[key in keyof ExtractSelectorsFromModel<TModels, TModel>]: ExtractSelectorsSignatureFromSelectorsModel<RematchRootState<TModels, TExtraModels>, ExtractSelectorsFromModel<TModels, TModel>, key>; | ||
}; | ||
export declare type Slicer<TSliceState, TRootState> = (<TReturns>(resultFn: (slice: TSliceState) => TReturns) => Selector<TRootState, TReturns>) & Selector<TRootState, TSliceState>; | ||
export interface ModelSelectorFactories<TModels extends Models<TModels> = Record<string, any>, TSliceState = any> { | ||
[key: string]: SelectorFactory<TModels, TSliceState> | SelectorParametricFactory<TModels, TSliceState>; | ||
export interface ModelSelectorFactories<TModels extends Models<TModels>, TExtraModels extends Models<TModels>, TSliceState = any> { | ||
[key: string]: SelectorFactory<TModels, TExtraModels, TSliceState> | SelectorParametricFactory<TModels, TExtraModels, TSliceState>; | ||
} | ||
export declare type StoreSelectors<TModels extends Models<TModels> = Record<string, any>> = { | ||
[TModelKey in keyof TModels]: ModelSelectors<TModels, TModels[TModelKey]>; | ||
export declare type StoreSelectors<TModels extends Models<TModels>, TExtraModels extends Models<TModels>> = { | ||
[TModelKey in keyof TModels]: ModelSelectors<TModels, TExtraModels, TModels[TModelKey]>; | ||
}; | ||
export declare type SelectorFactory<TModels extends Models<TModels> = Record<string, any>, TSliceState = any> = <TReturns>(this: ModelSelectorFactories<TModels, TSliceState>, models: StoreSelectors<TModels>) => Selector<RematchRootState<TModels>, TReturns>; | ||
export declare type SelectorParametricFactory<TModels extends Models<TModels> = Record<string, any>, TSliceState = any, TProps = any, TReturns = any> = (this: ModelSelectorFactories<TModels, TSliceState>, models: StoreSelectors<TModels>, props: TProps) => Selector<RematchRootState<TModels>, TReturns, TProps>; | ||
export declare type ParameterizerSelectorFactory<TModels extends Models<TModels> = Record<string, any>, TSliceState = any, TProps = any, TReturns = any> = (this: ModelSelectorFactories<TModels, TSliceState>, models: StoreSelectors<TModels>, props: TProps) => (props: TProps) => Selector<RematchRootState<TModels>, TReturns>; | ||
export declare type Parameterizer<TModels extends Models<TModels> = Record<string, any>, TSliceState = any> = <TProps, TReturns>(factory: SelectorParametricFactory<TModels, TSliceState, TProps, TReturns>) => ParameterizerSelectorFactory<TModels, TSliceState, TProps, TReturns>; | ||
export declare type ModelSelectorsFactory<TModels extends Models<TModels> = Record<string, any>, TSliceState = any> = (slice: Slicer<TSliceState, RematchRootState<TModels>>, createSelector: typeof Reselect.createSelector, hasProps: Parameterizer<TModels, TSliceState>) => ModelSelectorFactories<TModels, TSliceState>; | ||
export declare type ModelSelectorsConfig<TModels extends Models<TModels> = Record<string, any>, TSliceState = any> = ModelSelectorsFactory<TModels, TSliceState> | ModelSelectorFactories<TModels, TSliceState>; | ||
export declare type RematchSelect<TModels extends Models<TModels>, TRootState = RematchRootState<TModels>> = (<TReturn extends { | ||
export declare type SelectorFactory<TModels extends Models<TModels>, TExtraModels extends Models<TModels>, TSliceState = any> = <TReturns>(this: ModelSelectorFactories<TModels, TExtraModels, TSliceState>, models: StoreSelectors<TModels, TExtraModels>) => Selector<RematchRootState<TModels>, TReturns>; | ||
export declare type SelectorParametricFactory<TModels extends Models<TModels>, TExtraModels extends Models<TModels>, TSliceState = any, TProps = any, TReturns = any> = (this: ModelSelectorFactories<TModels, TExtraModels, TSliceState>, models: StoreSelectors<TModels, TExtraModels>, props: TProps) => Selector<RematchRootState<TModels>, TReturns, TProps>; | ||
export declare type ParameterizerSelectorFactory<TModels extends Models<TModels>, TExtraModels extends Models<TModels>, TSliceState = any, TProps = any, TReturns = any> = (this: ModelSelectorFactories<TModels, TExtraModels, TSliceState>, models: StoreSelectors<TModels, TExtraModels>, props: TProps) => (props: TProps) => Selector<RematchRootState<TModels>, TReturns>; | ||
export declare type Parameterizer<TModels extends Models<TModels>, TExtraModels extends Models<TModels>, TSliceState = any> = <TProps, TReturns>(factory: SelectorParametricFactory<TModels, TExtraModels, TSliceState, TProps, TReturns>) => ParameterizerSelectorFactory<TModels, TExtraModels, TSliceState, TProps, TReturns>; | ||
export declare type ModelSelectorsFactory<TModels extends Models<TModels>, TExtraModels extends Models<TModels>, TSliceState = any> = (slice: Slicer<TSliceState, RematchRootState<TModels>>, createSelector: typeof Reselect.createSelector, hasProps: Parameterizer<TModels, TExtraModels, TSliceState>) => ModelSelectorFactories<TModels, TExtraModels, TSliceState>; | ||
export declare type ModelSelectorsConfig<TModels extends Models<TModels>, TSliceState = any, TExtraModels extends Models<TModels> = Record<string, never>> = ModelSelectorsFactory<TModels, TExtraModels, TSliceState> | ModelSelectorFactories<TModels, TExtraModels, TSliceState>; | ||
export declare type RematchSelect<TModels extends Models<TModels>, TExtraModels extends Models<TModels>, TRootState = RematchRootState<TModels, TExtraModels>> = (<TReturn extends { | ||
[key: string]: (state: TRootState) => any; | ||
}>(mapSelectToProps: (select: RematchSelect<TModels>) => TReturn) => Reselect.OutputParametricSelector<TRootState, any, { | ||
}>(mapSelectToProps: (select: RematchSelect<TModels, TExtraModels>) => TReturn) => Reselect.OutputParametricSelector<TRootState, any, { | ||
[K in keyof TReturn]: ReturnType<TReturn[K]>; | ||
}, Reselect.Selector<TRootState, Record<string, any>>> & Reselect.OutputSelector<TRootState, { | ||
}, Reselect.Selector<TRootState, TRootState>> & Reselect.OutputSelector<TRootState, { | ||
[K in keyof TReturn]: ReturnType<TReturn[K]>; | ||
}, Reselect.Selector<TRootState, Record<string, any>>>) & StoreSelectors<TModels>; | ||
}, Reselect.Selector<TRootState, TRootState>>) & StoreSelectors<TModels, TExtraModels>; | ||
declare module '@rematch/core' { | ||
interface RematchStore<TModels extends Models<TModels> = Record<string, any>, TExtraModels extends Models<TModels> = Record<string, any>> extends ReduxStore<RematchRootState<TModels, TExtraModels>, Action> { | ||
select: RematchSelect<TModels>; | ||
interface RematchStore<TModels extends Models<TModels>, TExtraModels extends Models<TModels>> extends ReduxStore<RematchRootState<TModels, TExtraModels>, Action> { | ||
select: RematchSelect<TModels, TExtraModels, RematchRootState<TModels, TExtraModels>>; | ||
} | ||
interface Model<TModels extends Models<TModels> = Record<string, any>, TState = any> { | ||
interface Model<TModels extends Models<TModels>, TState = any> { | ||
selectors?: ModelSelectorsConfig<TModels, TState>; | ||
@@ -42,0 +42,0 @@ } |
{ | ||
"name": "@rematch/select", | ||
"version": "3.0.1", | ||
"version": "3.1.0", | ||
"sideEffects": false, | ||
"description": "Selectors plugin for Rematch", | ||
"homepage": "https://rematch.github.io/rematch", | ||
"homepage": "https://rematchjs.org", | ||
"main": "dist/index.js", | ||
@@ -30,14 +31,9 @@ "module": "dist/select.esm.js", | ||
"devDependencies": { | ||
"@rematch/core": "^2.0.1", | ||
"@rematch/core": "^2.1.0", | ||
"redux": "^4.0.5" | ||
}, | ||
"peerDependencies": { | ||
"@rematch/core": "^2.0.0", | ||
"@rematch/core": ">=2", | ||
"redux": ">=4" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "yarn lint" | ||
} | ||
}, | ||
"authors": [ | ||
@@ -59,3 +55,3 @@ "Sam Richard <sam.richard@gmail.com> (https://github.com/d3dc)", | ||
}, | ||
"gitHead": "e123bb5976bcc1ef7f178c2b685bed9805d80cda" | ||
"gitHead": "0f3d198961271397b86e31b8be94d6e7a9ed95b2" | ||
} |
@@ -55,4 +55,7 @@ import { | ||
const validateConfig = <TModels extends Models<TModels>>( | ||
config: SelectConfig<TModels> | ||
const validateConfig = < | ||
TModels extends Models<TModels>, | ||
TExtraModels extends Models<TModels> | ||
>( | ||
config: SelectConfig<TModels, TExtraModels> | ||
): void => { | ||
@@ -91,7 +94,7 @@ if (process.env.NODE_ENV !== 'production') { | ||
>( | ||
config: SelectConfig<TModels> = {} | ||
config: SelectConfig<TModels, TExtraModels> = {} | ||
): Plugin<TModels, TExtraModels> => { | ||
validateConfig(config) | ||
const sliceState: SelectConfig<TModels>['sliceState'] = | ||
const sliceState: SelectConfig<TModels, TExtraModels>['sliceState'] = | ||
config.sliceState || ((state, model) => state[model.name || '']) | ||
@@ -101,7 +104,7 @@ const selectorCreator = config.selectorCreator || createSelector | ||
const slice = (model: Model<TModels>) => ( | ||
stateOrNext: ExtractRematchStateFromModels<TModels> | ||
stateOrNext: ExtractRematchStateFromModels<TModels, TExtraModels> | ||
) => { | ||
if (typeof stateOrNext === 'function') { | ||
return selectorCreator( | ||
(state: ExtractRematchStateFromModels<TModels>) => | ||
(state: ExtractRematchStateFromModels<TModels, TExtraModels>) => | ||
sliceState(state, model), | ||
@@ -173,4 +176,3 @@ stateOrNext | ||
}, | ||
// @ts-ignore | ||
onStoreCreated(store: RematchStore) { | ||
onStoreCreated(store: RematchStore<TModels, TExtraModels>) { | ||
factoryGroup.startBuilding() | ||
@@ -177,0 +179,0 @@ // @ts-ignore |
114
src/types.ts
@@ -23,4 +23,4 @@ // Type definitions for @rematch/select 2.0.0 | ||
export type ExtractSelectorsFromModel< | ||
TModels extends Models<TModels> = Record<string, any>, | ||
TModel extends Model<TModels> = Model<TModels> | ||
TModels extends Models<TModels>, | ||
TModel extends Model<TModels> | ||
> = | ||
@@ -53,6 +53,7 @@ // thunk case: (models) => ({...}) | ||
export interface SelectConfig< | ||
TModels extends Models<TModels> = Record<string, any> | ||
TModels extends Models<TModels>, | ||
TExtraModels extends Models<TModels> | ||
> { | ||
sliceState?: ( | ||
state: ExtractRematchStateFromModels<TModels>, | ||
state: ExtractRematchStateFromModels<TModels, TExtraModels>, | ||
model: Model<TModels> | ||
@@ -64,4 +65,5 @@ ) => Record<string, any> | undefined | ||
export type ModelSelectors< | ||
TModels extends Models<TModels> = Record<string, any>, | ||
TModel extends Model<TModels> = Model<TModels> | ||
TModels extends Models<TModels>, | ||
TExtraModels extends Models<TModels>, | ||
TModel extends Model<TModels> | ||
> = { | ||
@@ -72,3 +74,3 @@ [key in keyof ExtractSelectorsFromModel< | ||
>]: ExtractSelectorsSignatureFromSelectorsModel< | ||
RematchRootState<TModels>, | ||
RematchRootState<TModels, TExtraModels>, | ||
ExtractSelectorsFromModel<TModels, TModel>, | ||
@@ -85,27 +87,35 @@ key | ||
export interface ModelSelectorFactories< | ||
TModels extends Models<TModels> = Record<string, any>, | ||
TModels extends Models<TModels>, | ||
TExtraModels extends Models<TModels>, | ||
TSliceState = any | ||
> { | ||
[key: string]: | ||
| SelectorFactory<TModels, TSliceState> | ||
| SelectorParametricFactory<TModels, TSliceState> | ||
| SelectorFactory<TModels, TExtraModels, TSliceState> | ||
| SelectorParametricFactory<TModels, TExtraModels, TSliceState> | ||
} | ||
export type StoreSelectors< | ||
TModels extends Models<TModels> = Record<string, any> | ||
TModels extends Models<TModels>, | ||
TExtraModels extends Models<TModels> | ||
> = { | ||
[TModelKey in keyof TModels]: ModelSelectors<TModels, TModels[TModelKey]> | ||
[TModelKey in keyof TModels]: ModelSelectors< | ||
TModels, | ||
TExtraModels, | ||
TModels[TModelKey] | ||
> | ||
} | ||
export type SelectorFactory< | ||
TModels extends Models<TModels> = Record<string, any>, | ||
TModels extends Models<TModels>, | ||
TExtraModels extends Models<TModels>, | ||
TSliceState = any | ||
> = <TReturns>( | ||
// FIXME: https://github.com/Microsoft/TypeScript/issues/27862 | ||
this: ModelSelectorFactories<TModels, TSliceState>, | ||
models: StoreSelectors<TModels> | ||
this: ModelSelectorFactories<TModels, TExtraModels, TSliceState>, | ||
models: StoreSelectors<TModels, TExtraModels> | ||
) => Selector<RematchRootState<TModels>, TReturns> | ||
export type SelectorParametricFactory< | ||
TModels extends Models<TModels> = Record<string, any>, | ||
TModels extends Models<TModels>, | ||
TExtraModels extends Models<TModels>, | ||
TSliceState = any, | ||
@@ -116,4 +126,4 @@ TProps = any, | ||
// FIXME: https://github.com/Microsoft/TypeScript/issues/27862 | ||
this: ModelSelectorFactories<TModels, TSliceState>, | ||
models: StoreSelectors<TModels>, | ||
this: ModelSelectorFactories<TModels, TExtraModels, TSliceState>, | ||
models: StoreSelectors<TModels, TExtraModels>, | ||
props: TProps | ||
@@ -124,3 +134,4 @@ ) => Selector<RematchRootState<TModels>, TReturns, TProps> | ||
export type ParameterizerSelectorFactory< | ||
TModels extends Models<TModels> = Record<string, any>, | ||
TModels extends Models<TModels>, | ||
TExtraModels extends Models<TModels>, | ||
TSliceState = any, | ||
@@ -131,4 +142,4 @@ TProps = any, | ||
// FIXME: https://github.com/Microsoft/TypeScript/issues/27862 | ||
this: ModelSelectorFactories<TModels, TSliceState>, | ||
models: StoreSelectors<TModels>, | ||
this: ModelSelectorFactories<TModels, TExtraModels, TSliceState>, | ||
models: StoreSelectors<TModels, TExtraModels>, | ||
props: TProps | ||
@@ -138,10 +149,24 @@ ) => (props: TProps) => Selector<RematchRootState<TModels>, TReturns> | ||
export type Parameterizer< | ||
TModels extends Models<TModels> = Record<string, any>, | ||
TModels extends Models<TModels>, | ||
TExtraModels extends Models<TModels>, | ||
TSliceState = any | ||
> = <TProps, TReturns>( | ||
factory: SelectorParametricFactory<TModels, TSliceState, TProps, TReturns> | ||
) => ParameterizerSelectorFactory<TModels, TSliceState, TProps, TReturns> | ||
factory: SelectorParametricFactory< | ||
TModels, | ||
TExtraModels, | ||
TSliceState, | ||
TProps, | ||
TReturns | ||
> | ||
) => ParameterizerSelectorFactory< | ||
TModels, | ||
TExtraModels, | ||
TSliceState, | ||
TProps, | ||
TReturns | ||
> | ||
export type ModelSelectorsFactory< | ||
TModels extends Models<TModels> = Record<string, any>, | ||
TModels extends Models<TModels>, | ||
TExtraModels extends Models<TModels>, | ||
TSliceState = any | ||
@@ -151,17 +176,19 @@ > = ( | ||
createSelector: typeof Reselect.createSelector, | ||
hasProps: Parameterizer<TModels, TSliceState> | ||
) => ModelSelectorFactories<TModels, TSliceState> | ||
hasProps: Parameterizer<TModels, TExtraModels, TSliceState> | ||
) => ModelSelectorFactories<TModels, TExtraModels, TSliceState> | ||
export type ModelSelectorsConfig< | ||
TModels extends Models<TModels> = Record<string, any>, | ||
TSliceState = any | ||
TModels extends Models<TModels>, | ||
TSliceState = any, | ||
TExtraModels extends Models<TModels> = Record<string, never> | ||
> = | ||
| ModelSelectorsFactory<TModels, TSliceState> | ||
| ModelSelectorFactories<TModels, TSliceState> | ||
| ModelSelectorsFactory<TModels, TExtraModels, TSliceState> | ||
| ModelSelectorFactories<TModels, TExtraModels, TSliceState> | ||
export type RematchSelect< | ||
TModels extends Models<TModels>, | ||
TRootState = RematchRootState<TModels> | ||
TExtraModels extends Models<TModels>, | ||
TRootState = RematchRootState<TModels, TExtraModels> | ||
> = (<TReturn extends { [key: string]: (state: TRootState) => any }>( | ||
mapSelectToProps: (select: RematchSelect<TModels>) => TReturn | ||
mapSelectToProps: (select: RematchSelect<TModels, TExtraModels>) => TReturn | ||
) => Reselect.OutputParametricSelector< | ||
@@ -171,3 +198,3 @@ TRootState, | ||
{ [K in keyof TReturn]: ReturnType<TReturn[K]> }, | ||
Reselect.Selector<TRootState, Record<string, any>> | ||
Reselect.Selector<TRootState, TRootState> | ||
> & | ||
@@ -177,5 +204,5 @@ Reselect.OutputSelector< | ||
{ [K in keyof TReturn]: ReturnType<TReturn[K]> }, | ||
Reselect.Selector<TRootState, Record<string, any>> | ||
Reselect.Selector<TRootState, TRootState> | ||
>) & | ||
StoreSelectors<TModels> | ||
StoreSelectors<TModels, TExtraModels> | ||
@@ -185,13 +212,14 @@ declare module '@rematch/core' { | ||
interface RematchStore< | ||
TModels extends Models<TModels> = Record<string, any>, | ||
TExtraModels extends Models<TModels> = Record<string, any> | ||
TModels extends Models<TModels>, | ||
TExtraModels extends Models<TModels> | ||
> extends ReduxStore<RematchRootState<TModels, TExtraModels>, Action> { | ||
select: RematchSelect<TModels> | ||
select: RematchSelect< | ||
TModels, | ||
TExtraModels, | ||
RematchRootState<TModels, TExtraModels> | ||
> | ||
} | ||
// add overloads for Model here. | ||
interface Model< | ||
TModels extends Models<TModels> = Record<string, any>, | ||
TState = any | ||
> { | ||
interface Model<TModels extends Models<TModels>, TState = any> { | ||
selectors?: ModelSelectorsConfig<TModels, TState> | ||
@@ -198,0 +226,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
95775
879