From 3c02738ec4c36d8414493ef8f0016a809d849d33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Ma=C5=82ecki?= Date: Mon, 20 Jan 2025 05:36:41 -0800 Subject: [PATCH] Add explicit types for Types and Properties in LayoutAnimation (#48728) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/48728 Changelog: [General][Changed] - Improved types for exported Types and Properties in LayoutAnimation Reviewed By: rshest Differential Revision: D68270119 fbshipit-source-id: 7e9e6e6f20b6c17990b40d423eb4571807004b49 --- .../react-native/Libraries/LayoutAnimation/LayoutAnimation.js | 4 ++-- .../Libraries/__tests__/__snapshots__/public-api-test.js.snap | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/react-native/Libraries/LayoutAnimation/LayoutAnimation.js b/packages/react-native/Libraries/LayoutAnimation/LayoutAnimation.js index a14283e1e7e..cc00b37e2ce 100644 --- a/packages/react-native/Libraries/LayoutAnimation/LayoutAnimation.js +++ b/packages/react-native/Libraries/LayoutAnimation/LayoutAnimation.js @@ -174,13 +174,13 @@ const LayoutAnimation = { easeIn: 'easeIn', easeOut: 'easeOut', keyboard: 'keyboard', - }), + }) as $ReadOnly<{[K in LayoutAnimationType]: K}>, Properties: Object.freeze({ opacity: 'opacity', scaleX: 'scaleX', scaleY: 'scaleY', scaleXY: 'scaleXY', - }), + }) as $ReadOnly<{[K in LayoutAnimationProperty]: K}>, checkConfig(...args: Array) { console.error('LayoutAnimation.checkConfig(...) has been disabled.'); }, 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 a7e2a4da654..ff5b2b5853c 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 @@ -5635,8 +5635,8 @@ declare const Presets: { declare const LayoutAnimation: { configureNext: configureNext, create: create, - Types: $FlowFixMe, - Properties: $FlowFixMe, + Types: $ReadOnly<{ [K in LayoutAnimationType]: K }>, + Properties: $ReadOnly<{ [K in LayoutAnimationProperty]: K }>, checkConfig(...args: Array): void, Presets: Presets, easeInEaseOut: (onAnimationDidEnd?: OnAnimationDidEndCallback) => void,