-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix TurboModuleRegistry TS type #35885
Conversation
Base commit: 0c150b2 |
LGTM for importing TurboModuleRegistry from its path, though for most cases you should probably prefer using the public export for this instead of reaching into a file inside the package. I know there are places where our own documentation doesn't do this though. |
I.e. prefer "import {TurboModuleRegistry} from 'react-native'" |
@NickGerleman has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@NickGerleman merged this pull request in c289442. |
Yea I realized after working on this that it is also a public export from react-native. |
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: #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
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: facebook#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
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
Test Plan
Tested that the import doesn't generate a type error when used correctly.