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

[@types/react-dom] fix: react-dom flushSync types #69241

Merged
merged 3 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion types/react-dom/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export const render: Renderer;
export const hydrate: Renderer;

export function flushSync<R>(fn: () => R): R;
export function flushSync<A, R>(fn: (a: A) => R, a: A): R;

export function unstable_batchedUpdates<A, R>(callback: (a: A) => R, a: A): R;
export function unstable_batchedUpdates<R>(callback: () => R): R;
Expand Down
4 changes: 2 additions & 2 deletions types/react-dom/test/react-dom-tests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ describe("ReactDOM", () => {
ReactDOM.flushSync(() => {});
// $ExpectType number
ReactDOM.flushSync(() => 42);
// $ExpectType number
// @ts-expect-error
ReactDOM.flushSync(() => 42, "not used");
// $ExpectType number
// @ts-expect-error
ReactDOM.flushSync((a: string) => 42, "not used");
// @ts-expect-error
ReactDOM.flushSync((a: string) => 42);
Expand Down