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 reactBatchedUpdates to TypeScript #1746

Merged

Conversation

AlexMunoz
Copy link
Contributor

Hello!
here is my small contribution to #1737.
I added ts-ignore comments to ignore the missing types.

@netlify
Copy link

netlify bot commented Jun 29, 2021

✔️ Deploy Preview for react-redux-docs ready!

🔨 Explore the source changes: 930e0f4

🔍 Inspect the deploy log: https://app.netlify.com/sites/react-redux-docs/deploys/60db9781d080370008b30e64

😎 Browse the preview: https://deploy-preview-1746--react-redux-docs.netlify.app

@markerikson
Copy link
Contributor

Per the @types/react-dom package, the types for unstable_batchedUpdates are:

export function unstable_batchedUpdates<A, B>(callback: (a: A, b: B) => any, a: A, b: B): void;
export function unstable_batchedUpdates<A>(callback: (a: A) => any, a: A): void;
export function unstable_batchedUpdates(callback: () => any): void;

Can we add those into a types file here somewhere, and at least use an as cast or something to force both of those files to use that type?

@timdorr timdorr force-pushed the reactBatchedUpdates-ts branch 2 times, most recently from 88955b9 to 766dc5a Compare June 29, 2021 21:15
@markerikson
Copy link
Contributor

hmm. something's not right with that last push - now it's showing all the other changes from the typescript branch that are already in that branch :)

@AlexMunoz
Copy link
Contributor Author

Hi @markerikson, I just fixed it!

I added the type definitions for unstable_batchedUpdates using a declaration file.

@markerikson
Copy link
Contributor

Cool. I'm not sure how having declarations of other modules will end up affecting the typings we output from the build process, but let's get this in now and worry about that later :) Thanks!

@markerikson markerikson merged commit c3764dd into reduxjs:typescript-port Jun 30, 2021
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.

2 participants