Skip to content
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

Convert connect components and logic to TS (with caveats) #1758

Merged
merged 7 commits into from Jul 7, 2021

Conversation

markerikson
Copy link
Contributor

@markerikson markerikson commented Jul 6, 2021

This PR:

  • Converts connectAdvanced, connect, and selectorFactory to TS
  • Removes the deprecated argument warnings left over from the v6-v7 transition (ie, "withRef is not an option any more", etc)

These 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

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 6, 2021

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:

Sandbox Source
Vanilla Configuration
Vanilla Typescript Configuration

@github-actions
Copy link

github-actions bot commented Jul 6, 2021

Size Change: -373 B (1%)

Total Size: 19 kB

Filename Size Change
dist/react-redux.js 14.3 kB -330 B (2%)
dist/react-redux.min.js 4.71 kB -43 B (0%)

compressed-size-action

@netlify
Copy link

netlify bot commented Jul 6, 2021

✔️ 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

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]
Copy link
Contributor

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!

@markerikson
Copy link
Contributor Author

Well, let's get this in, and we can review the types later.

@markerikson markerikson merged commit b8a118a into typescript-port Jul 7, 2021
@markerikson markerikson deleted the feature/connect-ts branch July 7, 2021 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants