Commit 604577b
committed
Fix a bug in the RTKQ selector typings causing bad state args
The `ReducerPath` type tries to extract the generic type for "the
path of the reducer" arg from `EndpointDefinitions`. However, it
looks like this was always off by one: getting the 4th arg instead
of the actual 5th arg.
This caused bad input to the generated selectors. That seems to
have worked okay with Reselect 4.0 and its looser types, but
caused problems when we updated to Reselect 4.1.x and its improved
types. The `RootState` type collapsed down to an empty object,
because there was no valid string to use as an object key.
This fixes the bug and adds a typetest to verify that the selector
types are carried through all the way.1 parent 4bb0c5c commit 604577b
File tree
2 files changed
+57
-2
lines changed- packages/toolkit/src/query
- tests
2 files changed
+57
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
464 | 464 | | |
465 | 465 | | |
466 | 466 | | |
467 | | - | |
468 | | - | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
469 | 470 | | |
470 | 471 | | |
471 | 472 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
0 commit comments