From 3bb86b0ecfaf5c881ce38719f87f0eccb402eeaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Ma=C5=82ecki?= Date: Tue, 25 Mar 2025 03:47:30 -0700 Subject: [PATCH] Change Animated re-export to generate correct namespace in TS (#50222) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/50222 The flow-api-translator will generate ```ts export * as default from './AnimatedExports'; ``` in TS which preserves the namespace. Previous import, export translated to: ```ts declare const $$EXPORT_DEFAULT_DECLARATION$$: typeof Animated; declare type $$EXPORT_DEFAULT_DECLARATION$$ = typeof $$EXPORT_DEFAULT_DECLARATION$$; export default $$EXPORT_DEFAULT_DECLARATION$$; ``` which dropped the `Animated` namespace. Changelog: [Internal] Reviewed By: huntie Differential Revision: D71737199 fbshipit-source-id: a46a7ddddd023fa831cd4bb50f17a0641f328066 --- packages/react-native/Libraries/Animated/Animated.js.flow | 4 +--- .../Libraries/__tests__/__snapshots__/public-api-test.js.snap | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/react-native/Libraries/Animated/Animated.js.flow b/packages/react-native/Libraries/Animated/Animated.js.flow index 0b003cc39cb..0520696bdeb 100644 --- a/packages/react-native/Libraries/Animated/Animated.js.flow +++ b/packages/react-native/Libraries/Animated/Animated.js.flow @@ -9,7 +9,5 @@ * @oncall react_native */ -import * as Animated from './AnimatedExports'; - +export * as default from './AnimatedExports'; export type {CompositeAnimation, Numeric} from './AnimatedImplementation'; -export default Animated; diff --git a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap index bfe1ed4d062..a6e8cb8588b 100644 --- a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap +++ b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap @@ -118,8 +118,8 @@ declare export default typeof Animated; `; exports[`public API should not change unintentionally Libraries/Animated/Animated.js.flow 1`] = ` -"export type { CompositeAnimation, Numeric } from \\"./AnimatedImplementation\\"; -declare export default typeof Animated; +"export * as default from \\"./AnimatedExports\\"; +export type { CompositeAnimation, Numeric } from \\"./AnimatedImplementation\\"; " `;