From 5931eed92fcb96c05ceccc7a6adc0387543c6e96 Mon Sep 17 00:00:00 2001 From: Max Thirouin Date: Wed, 26 Mar 2025 13:32:24 +0100 Subject: [PATCH] fix globals types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently some exported types use const keywords. But this doesn't look right as explained in TypeScript 3.4 changelog. > Note that global variables declared with let and const don’t show up on globalThis. https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#type-checking-for-globalthis This means with current const declaration, this defined types are not accessible, which defeat the purpose. This PR should fix this problem (currently works for me using patch-package). --- packages/react-native/src/types/globals.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/react-native/src/types/globals.d.ts b/packages/react-native/src/types/globals.d.ts index 9616f6d0d963..f7612c7692e0 100644 --- a/packages/react-native/src/types/globals.d.ts +++ b/packages/react-native/src/types/globals.d.ts @@ -43,19 +43,19 @@ declare global { * * @see https://github.com/facebook/react-native/issues/934 */ - const originalXMLHttpRequest: any; + var originalXMLHttpRequest: any; - const __BUNDLE_START_TIME__: number; - const ErrorUtils: ErrorUtils; + var __BUNDLE_START_TIME__: number; + var ErrorUtils: ErrorUtils; /** * This variable is set to true when react-native is running in Dev mode * @example * if (__DEV__) console.log('Running in dev mode') */ - const __DEV__: boolean; + var __DEV__: boolean; - const HermesInternal: null | {}; + var HermesInternal: null | {}; // #region Timer Functions