Files
react-native/Libraries/TurboModule/TurboModuleRegistry.d.ts
T
Janic Duplessis c289442848 Fix TurboModuleRegistry TS type (#35885)
Summary:
TurboModuleRegistry export functions and not a TurboModuleRegistry object. See https://github.com/facebook/react-native/blob/main/Libraries/TurboModule/TurboModuleRegistry.js#L37

## Changelog

[GENERAL] [FIXED] - Fix TurboModuleRegistry TS type

Pull Request resolved: https://github.com/facebook/react-native/pull/35885

Test Plan:
Tested that the import doesn't generate a type error when used correctly.

```ts
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';

export default TurboModuleRegistry.get<Spec>('RNCSafeAreaContext');
```

Reviewed By: christophpurrer

Differential Revision: D42604208

Pulled By: NickGerleman

fbshipit-source-id: e6259df24aaf6e37b32cc4b51947294fd655837e
2023-01-19 05:56:51 -08:00

14 lines
386 B
TypeScript

/**
* 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
*/
import {TurboModule} from './RCTExport';
export function get<T extends TurboModule>(name: string): T | null;
export function getEnforcing<T extends TurboModule>(name: string): T;