-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Convert connect components and logic to TS (with caveats) #1758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 4d22f6a:
|
Size Change: -373 B (1%) Total Size: 19 kB
|
✔️ Deploy Preview for react-redux-docs ready! 🔨 Explore the source changes: 4d22f6a 🔍 Inspect the deploy log: https://app.netlify.com/sites/react-redux-docs/deploys/60e5eb8eb7d61f00087fe3e6 😎 Browse the preview: https://deploy-preview-1758--react-redux-docs.netlify.app |
src/components/connectAdvanced.tsx
Outdated
const [, updateCount] = state | ||
return [action.payload, updateCount + 1] | ||
} | ||
|
||
type UseLayoutEffect = typeof useLayoutEffect | ||
type EffectFunc = (...args: any[]) => void | ReturnType<React.EffectCallback> | ||
type EffectDeps = Parameters<UseLayoutEffect>[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a DependencyList
type exported from react
if you'd like to use that instead!
Well, let's get this in, and we can review the types later. |
This PR:
connectAdvanced
,connect
, andselectorFactory
to TSThese types are absolutely not final! For one thing, I guarantee this isn't actually inferring the right props and carrying them through. That's going to take a lot more work (and probably from someone other than me).
Also, I had to slap a bunch of
unknown
and// @ts-ignore
everywhere. Some of those can maybe stay, because they're internal implementation details that aren't worth fussing over. Others probably ought to be fixed.But, I've at least managed to hack together enough types to get the files compiling without errors and sorta-mostly look correct-ish.
Ref: #1737