Skip to content

Commit

Permalink
Merge pull request #227 from spierala/217-createFeatureStateSelector-…
Browse files Browse the repository at this point in the history
…deprecation-warning

fix(mini-rx-store): fix wrong deprecation warning
  • Loading branch information
spierala authored Dec 19, 2024
2 parents 80c2acb + dcf58c4 commit 861a925
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions libs/mini-rx-store/src/lib/selector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,9 @@ export function createSelector(...args: any[]): Selector<any, any> {
});
}

/** @deprecated Use `createFeatureStateSelector` which is more in line with `createComponentStateSelector` */
export function createFeatureSelector<T>(featureKey?: string): Selector<object, T>;
/** @deprecated Use `createFeatureStateSelector` which is more in line with `createComponentStateSelector` */
export function createFeatureSelector<T, V>(featureKey: keyof T): Selector<T, V>;
/** @deprecated Use `createFeatureStateSelector` which is more in line with `createComponentStateSelector` */
export function createFeatureSelector(featureKey?: any): Selector<any, any> {
export function createFeatureStateSelector<T>(featureKey?: string): Selector<object, T>;
export function createFeatureStateSelector<T, V>(featureKey: keyof T): Selector<T, V>;
export function createFeatureStateSelector(featureKey?: any): Selector<any, any> {
if (featureKey) {
return createSelector(
(state: any) => state[featureKey],
Expand All @@ -133,7 +130,15 @@ export function createFeatureSelector(featureKey?: any): Selector<any, any> {
return (state) => state; // Do not memoize: when used with FeatureStore there is a new state object created for every `setState`
}

export const createFeatureStateSelector = createFeatureSelector;
/** @deprecated Use `createFeatureStateSelector` which is more in line with `createComponentStateSelector` */
export function createFeatureSelector<T>(featureKey?: string): Selector<object, T>;
/** @deprecated Use `createFeatureStateSelector` which is more in line with `createComponentStateSelector` */
export function createFeatureSelector<T, V>(featureKey: keyof T): Selector<T, V>;
/** @deprecated Use `createFeatureStateSelector` which is more in line with `createComponentStateSelector` */
export function createFeatureSelector(featureKey?: any): Selector<any, any> {
return createFeatureStateSelector(featureKey);
}

export function createComponentStateSelector<T>(): Selector<T, T> {
return (state: T) => state;
}
Expand Down

0 comments on commit 861a925

Please sign in to comment.