From 71157f6ba604a57b9fa79bc0401b89dc0b01145b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=E2=84=93e=20Hensel?= Date: Wed, 1 Mar 2023 11:36:03 -0800 Subject: [PATCH] update type definitions for unstable_batchedUpdates (#36180) Summary: This PR fixes the type definitions for `unstable_batchedUpdates`. The same change was recently made on DefinitelyTyped - see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/63517 for a more detailed explanation ## Changelog [General] [Fixed] - fix type definition for `unstable_batchedUpdates` Pull Request resolved: https://github.com/facebook/react-native/pull/36180 Test Plan: Note how the typescript defintions now match [the flow definitions](https://github.com/facebook/react-native/blob/43636267011a97490ed7495b08e500c5d0d54872/Libraries/ReactNative/RendererImplementation.js#L99), and note how [the tests in DefinitelyTyped](https://github.com/k-yle/DefinitelyTyped/blob/a4e15e3c2b9c6d689918cbbfa98c02cd26fe7681/types/react-dom/test/react-dom-tests.tsx#L231-L238) are passing. Reviewed By: christophpurrer, cortinico Differential Revision: D43367314 Pulled By: lunaleaps fbshipit-source-id: 74351daaf2c00a372f4e28992d41ebd2cbb1c7cc --- types/public/ReactNativeRenderer.d.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/types/public/ReactNativeRenderer.d.ts b/types/public/ReactNativeRenderer.d.ts index 542788c77b5b73..eb136cbc399649 100644 --- a/types/public/ReactNativeRenderer.d.ts +++ b/types/public/ReactNativeRenderer.d.ts @@ -140,10 +140,5 @@ export interface GestureResponderHandlers { /** * React Native also implements unstable_batchedUpdates */ -export function unstable_batchedUpdates( - callback: (a: A, b: B) => any, - a: A, - b: B, -): void; -export function unstable_batchedUpdates(callback: (a: A) => any, a: A): void; -export function unstable_batchedUpdates(callback: () => any): void; +export function unstable_batchedUpdates(callback: (a: A) => R, a: A): R; +export function unstable_batchedUpdates(callback: () => R): R;