From 6bc95b2074a794607a34eae201f07dae110c2832 Mon Sep 17 00:00:00 2001 From: Kudo Chien Date: Fri, 8 Mar 2024 02:30:17 -0800 Subject: [PATCH] Add registerCallableModule types (#43366) Summary: `registerCallableModule()` was added from 7f549ec7bebe but no typescript types there. this pr tries to add the corresponding types. ## Changelog: [GENERAL] [FIXED] - Add missing `registerCallableModule` TypeScript definitions Pull Request resolved: https://github.com/facebook/react-native/pull/43366 Test Plan: patch locally and try to `import { registerCallableModule } from 'react-native';` in a 0.74.0-rc.2 project Reviewed By: fabriziocucci Differential Revision: D54676151 Pulled By: cortinico fbshipit-source-id: cd01f2ebe2d2516b458fae5b2e83cba3d3794455 --- .../Libraries/Core/registerCallableModule.d.ts | 16 ++++++++++++++++ packages/react-native/types/index.d.ts | 1 + 2 files changed, 17 insertions(+) create mode 100644 packages/react-native/Libraries/Core/registerCallableModule.d.ts diff --git a/packages/react-native/Libraries/Core/registerCallableModule.d.ts b/packages/react-native/Libraries/Core/registerCallableModule.d.ts new file mode 100644 index 00000000000000..05d9e92da7c717 --- /dev/null +++ b/packages/react-native/Libraries/Core/registerCallableModule.d.ts @@ -0,0 +1,16 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +type Module = Object; +type RegisterCallableModule = ( + name: string, + moduleOrFactory: Module | (() => Module), +) => void; + +export const registerCallableModule: RegisterCallableModule; diff --git a/packages/react-native/types/index.d.ts b/packages/react-native/types/index.d.ts index b23e2e0a2ff267..5aeec0685ed009 100644 --- a/packages/react-native/types/index.d.ts +++ b/packages/react-native/types/index.d.ts @@ -103,6 +103,7 @@ export * from '../Libraries/Components/View/View'; export * from '../Libraries/Components/View/ViewAccessibility'; export * from '../Libraries/Components/View/ViewPropTypes'; export * from '../Libraries/Components/Button'; +export * from '../Libraries/Core/registerCallableModule'; export * from '../Libraries/DevToolsSettings/DevToolsSettingsManager'; export * from '../Libraries/EventEmitter/NativeEventEmitter'; export * from '../Libraries/EventEmitter/RCTDeviceEventEmitter';