question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

shallowEqual breaks typed selector return type

See original GitHub issue

What version of React, ReactDOM/React Native, Redux, and React Redux are you using?

  • React: 18.2.0
  • ReactDOM/React Native: 18.2.0
  • Redux: 4.2.0
  • React Redux: 8.0.4

What is the current behavior?

without shallowEqual type inferred correctly image

otherwise it breaks image

What is the expected behavior?

types infer correctly with shallowEqual

Which browser and OS are affected by this issue?

No response

Did this work in previous versions of React Redux?

  • Yes

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
phryneascommented, Oct 26, 2022

We’ll need a few type tests for that before @markerikson pulls the lever on that - I’ll try to get to that in the next few days. Meanwhile, that CI build should work nicely I hope?

0reactions
justgowacommented, Nov 7, 2022

@phryneas i get it, i’m working on pretty old project and unfortunatly it started with non strict rules. Anyway, thank you a lot!

Read more comments on GitHub >

github_iconTop Results From Across the Web

shallowEqual should be generic · Issue #1348 · reduxjs/react ...
When using TypeScript, the return type of useSelector() gets automatically inferred from the arguments passed, which is great.
Read more >
React's useSelector with array of objects - Stack Overflow
This approach causes a rerender whenever any of the objects in the array change :/ const Message = () => { const data...
Read more >
Redux Essentials, Part 6: Performance and Normalizing Data
The official Redux Essentials tutorial: learn how to improve app performance and structure data correctly.
Read more >
enzyme-shallow-equal | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >
How to make an offline first React App - LinkedIn
app.todoItem, }; }, shallowEqual); const dispatch = useDispatch(); // redux hook methods end return ( <> <Input type="text" name= ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found