inject type improvements #3741
Closed
miraage
started this conversation in
Show and tell
Replies: 1 comment
-
Not sure if it should be fixed, since the recommended way to obtain stores is through React Context: https://github.com/mobxjs/mobx/tree/main/packages/mobx-react#provider-and-inject It doesn't have such issues with TS |
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
-
Hello. I was looking for a way to make inject returned typed component properly. I found a workaround that seems to be working for me. I'd like to ask to review this solution and maybe possibly ship it as default in the mobx-react package.
The proposed change is the return type of the inner function
T extends IReactComponent<infer P> ? IReactComponent<Omit<P, K[number]>> : never
It would require some changes to work for decorator, but that's the basic idea.
Beta Was this translation helpful? Give feedback.
All reactions