useShallow types are too restrictive #2959
Replies: 1 comment
-
Actually, this might have been an issue with my code. I modified the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Bug Description
Given that the
useShallow
function just takes in a function and returns that same signature, the current type signature is too restrictive, and causes issues with specific shadowing uses. For example, I have a utility to generate a store to be used in context, and returns a custom controller component. WithoutuseShallow
this works perfectly with types. However, withuseShallow
it loses all the types.The current type:
Recommended Type:
Reproduction Link
https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAJQKYEMDGMA0cDecYCeYScAClBGAM4DqwMAFgMIPAA2AJlEgHbaHFEqDADkIHJNjTcUMJEwg85ADyxwArlXmKVazUmQAzOAF84hiiDgByGRmsAoUJFi58REgGUY0JAEEwYCkZOW9fbH0w7lNzSxsAL00YFB4OR2doeDxIhhQ2NggAdxiLCCtrRKpk1IB6Oxgaqlz8oscHAS8fbgARYCowWTQGAB5vWSQAPjgAXjgo-0DR5LkJgG1rLRgxuWsAXQd2jzmkNiQMaAAxdR40JfGp2ZwHAEgACgBKAC455aQX0Ymry0p3OUAA-N8gb9vtskO8ZlNPF85g4TAcOnAFEoKPkkFByJQqHc5NhPA9cC9gWcuhC4FDxjDfvDpoiXtxUnjIWAKNRvk9ns8qgy5nAkKpeBwqBoOYZgDwkBw4GCfuM4DCXs8OH0BjAhozfL1+oMRrCJi8TMypsh0DAxBJUQcxS54IZrhhgIo4NJUHIsbp5sTJlDfEwQtBIZaVXJ4fy0IoqpidGL4LNveM-cnXmnQl0kIHAVUQ2GoO93gdnnGeAnIidqdAZnSgbXQd8UgRLRrIrnXvoM6pXn2YO9sFTQaW4CgpZ5m10rjd8+XXTcYB6eGQKAA3YASKCvPBDdhcXimb4E6h0RgsQ-smMa7gwdRQNevDXPYaDgB0BK3O7gG7y6hINMOD6EYWYhEgAamsG3Chj60Clh+aCPuyMAmGaAoCjgB6cOyaKYcMNSft+254hhzxls8aIvEu7qevoho6kMHz6j02rGvmF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