Skip to content

Commit 1c206c6

Browse files
authored
Merge pull request #45 from denbezrukov/feature/update-packages
Feature/update packages
2 parents 0ad8393 + 36604dd commit 1c206c6

18 files changed

+215
-246
lines changed

examples/redux-todos/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
"@types/react-dom": "^17.0.0",
1212
"@types/react-redux": "^7.1.12",
1313
"@types/uuid": "^8.3.0",
14-
"re-reselect": "^4.0.0",
14+
"re-reselect": "^4.0.1",
1515
"react": "^16.13.1",
1616
"react-dom": "^16.13.1",
1717
"react-redux": "^7.2.2",
1818
"redux": "^4.0.5",
19-
"reselect": "^4.0.0",
19+
"reselect": "^4.1.6",
2020
"reselect-utils": "^2.0.0-beta.16",
2121
"typescript-fsa": "^3.0.0",
2222
"typescript-fsa-reducers": "^1.2.2",
@@ -27,7 +27,7 @@
2727
"html-webpack-plugin": "^5.3.1",
2828
"ts-loader": "^9.0.0",
2929
"ts-node": "^9.1.1",
30-
"typescript": "^4.1.3",
30+
"typescript": "^4.7.4",
3131
"webpack": "^5.33.2",
3232
"webpack-cli": "^4.6.0",
3333
"webpack-dev-server": "^3.11.2"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
"ts-node": "^9.1.1",
8080
"tslib": "^2.0.3",
8181
"typedoc": "^0.19.2",
82-
"typescript": "^4.1.3",
82+
"typescript": "^4.7.4",
8383
"use-media": "^1.4.0",
8484
"yarn-deduplicate": "^3.1.0"
8585
},

packages/eslint-plugin-reselect-utils/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@
2222
"build": "yarn clean && yarn build:cjs && yarn build:es"
2323
},
2424
"dependencies": {
25-
"@typescript-eslint/experimental-utils": "^4.17.0"
25+
"@typescript-eslint/experimental-utils": "^5.31.0"
2626
},
2727
"peerDependencies": {
28-
"@typescript-eslint/parser": "^4.17.0",
29-
"typescript": "^4.2.3"
28+
"@typescript-eslint/parser": "^5.31.0",
29+
"typescript": "^4.7.4"
3030
},
3131
"devDependencies": {
3232
"common-tags": "^1.8.0",
33-
"re-reselect": "^4.0.0",
34-
"reselect": "^4.0.0",
33+
"re-reselect": "^4.0.1",
34+
"reselect": "^4.1.6",
3535
"reselect-utils": "^2.0.0-beta.16"
3636
}
3737
}

packages/eslint-plugin-reselect-utils/src/rules/noDifferentProps.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ export const noDifferentPropsRule = ruleCreator({
3131
] as [Options],
3232
meta: {
3333
docs: {
34-
category: 'Possible Errors',
3534
description: 'Cached selector and key selector must have same props.',
3635
recommended: 'error',
3736
},
@@ -71,7 +70,7 @@ export const noDifferentPropsRule = ruleCreator({
7170
);
7271
const keySelector = getKeySelector(cachedOptions);
7372

74-
if (keySelector) {
73+
if (keySelector && keySelector.valueDeclaration) {
7574
const keySelectorType = typeChecker.getTypeOfSymbolAtLocation(
7675
keySelector,
7776
keySelector.valueDeclaration,

packages/eslint-plugin-reselect-utils/src/rules/requireKeySelector.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ export const requireKeySelectorRule = ruleCreator({
1919
defaultOptions: [],
2020
meta: {
2121
docs: {
22-
category: 'Possible Errors',
2322
description: 'Cached selector can`t work without key selector.',
2423
recommended: 'error',
2524
},

packages/eslint-plugin-reselect-utils/src/utils/getSelectorProps.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
import ts from 'typescript';
22

3+
export function getTypeArguments(
4+
type: ts.TypeReference,
5+
checker: ts.TypeChecker,
6+
): readonly ts.Type[] {
7+
// getTypeArguments was only added in TS3.7
8+
if (checker.getTypeArguments) {
9+
return checker.getTypeArguments(type);
10+
}
11+
12+
return type.typeArguments ?? [];
13+
}
14+
315
export const getSelectorProps = (
416
selectorType: ts.Type,
517
typeChecker: ts.TypeChecker,
@@ -12,15 +24,17 @@ export const getSelectorProps = (
1224
return [];
1325
}
1426

15-
const [, props] = signature.parameters;
16-
if (props === undefined) {
27+
const [, props] = signature.getParameters();
28+
if (props === undefined || props.valueDeclaration === undefined) {
1729
return [];
1830
}
1931

20-
const propsType = typeChecker.getTypeOfSymbolAtLocation(
32+
const nodeType = typeChecker.getTypeOfSymbolAtLocation(
2133
props,
2234
props.valueDeclaration,
2335
);
2436

25-
return typeChecker.getPropertiesOfType(propsType);
37+
const [params] = getTypeArguments(nodeType as ts.TypeReference, typeChecker);
38+
39+
return typeChecker.getPropertiesOfType(params ?? nodeType);
2640
};

packages/reselect-utils/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
"@types/react": "^17.0.0",
3131
"cytoscape": "^3.17.1",
3232
"cytoscape-dagre": "^2.3.2",
33-
"re-reselect": "^4.0.0",
33+
"re-reselect": "^4.0.1",
3434
"react": "^16.13.1",
35-
"reselect": "^4.0.0",
35+
"reselect": "^4.1.6",
3636
"reselect-tools": "^0.0.7"
3737
}
3838
}

packages/reselect-utils/src/__tests__/createChainSelector.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ describe('createChainSelector', () => {
8484
);
8585

8686
(fullNameNamedSelector as NamedParametricSelector<
87+
unknown,
8788
unknown,
8889
unknown,
8990
unknown
@@ -99,7 +100,7 @@ describe('createChainSelector', () => {
99100
.build();
100101

101102
expect(personByMessageIdSelector.selectorName).toMatchInlineSnapshot(
102-
`"messageSelector (will be chained 9012) (will be chained 8867)"`,
103+
`"messageSelector (will be chained 9217) (will be chained 9072)"`,
103104
);
104105

105106
personByMessageIdSelector(commonState, { id: 100 });
@@ -115,7 +116,7 @@ describe('createChainSelector', () => {
115116
expect(
116117
(higherOrderSelector as NamedSelector<unknown, unknown>).selectorName,
117118
).toMatchInlineSnapshot(
118-
`"higher order for messageSelector (chained by personSelector (id -> [*])) (8867)"`,
119+
`"higher order for messageSelector (chained by personSelector (id -> [*])) (9072)"`,
119120
);
120121
});
121122

packages/reselect-utils/src/createCachedSequenceSelector.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import { Options, ParametricOptions } from './types';
44
import { createSequenceSelector } from './createSequenceSelector';
55

66
export function createCachedSequenceSelector<S, R>(
7-
selectors: Selector<S, R>[],
7+
selectors: Selector<S, R, never>[],
88
): (
9-
options: Options<S, (...results: R[]) => R[], Selector<S, R>[]>,
10-
) => Selector<S, R[]>;
9+
options: Options<S, (...results: R[]) => R[], Selector<S, R, never>[]>,
10+
) => Selector<S, R[], never>;
1111

1212
export function createCachedSequenceSelector<S, P, R>(
1313
selectors: ParametricSelector<S, P, R>[],

packages/reselect-utils/src/createCachedStructuredSelector.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ import { createStructuredSelector } from './createStructuredSelector';
55

66
export function createCachedStructuredSelector<M>(
77
selectors: M,
8-
): M extends { [K in keyof M]: Selector<infer S, unknown> }
8+
): M extends { [K in keyof M]: Selector<infer S, unknown, never> }
99
? (
1010
options: Options<
1111
S,
1212
(...results: unknown[]) => { [K in keyof M]: ReturnType<M[K]> },
13-
Selector<S, unknown>[]
13+
Selector<S, unknown, never>[]
1414
>,
15-
) => Selector<S, { [K in keyof M]: ReturnType<M[K]> }>
15+
) => Selector<S, { [K in keyof M]: ReturnType<M[K]> }, never>
1616
: M extends { [K in keyof M]: ParametricSelector<infer S, infer P, unknown> }
1717
? (
1818
options: ParametricOptions<

0 commit comments

Comments
 (0)