From af21f260a1cee460d11fc9c292aaa9f602cbd5a4 Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Tue, 20 May 2025 00:52:43 -0700 Subject: [PATCH] fix(types): Reference `global.d.ts` using `path` not `types` (#51104) Summary: After https://github.com/facebook/react-native/pull/49516 TSC would not find the global types. Types reference expect a package name but was given a path to a declaration. TS doc: https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html#-reference-path- This PR changes `types` to `path` to fix the issue. `dtslint` fails with `no-bad-reference` rule, but the `../src` lives in the same package in `react-native` package. [GENERAL] [FIXED] - Reference `global.d.ts` using `path` so they can be resolved by TSC Pull Request resolved: https://github.com/facebook/react-native/pull/51104 Test Plan: Before the change with current RN 0.79.2 TSC would fail on resolving the global types (example from [Sentry RN SDK build](https://github.com/getsentry/sentry-react-native/commit/134d810cf95416091779806e00d3a3cc6cbace89)): ![Screenshot 2025-05-05 at 17 18 04](https://github.com/user-attachments/assets/b264c8da-aa21-49d8-9597-82586291a01a) After the change to path TSC finds the global types. Using TSC Version 4.9.5 Reviewed By: huntie Differential Revision: D74208815 Pulled By: coado fbshipit-source-id: 2fd51d79061ffb356c047604213cff7a425f167e --- packages/react-native/types/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/react-native/types/index.d.ts b/packages/react-native/types/index.d.ts index d376104312c..7a0441d34ae 100644 --- a/packages/react-native/types/index.d.ts +++ b/packages/react-native/types/index.d.ts @@ -68,9 +68,10 @@ /// /// /// -/// +/// /// + export * from '../Libraries/ActionSheetIOS/ActionSheetIOS'; export * from '../Libraries/Alert/Alert'; export * from '../Libraries/Animated/Animated';