Skip to content

Commit

Permalink
Extract SourceCode TM type for react-native-codegen (#39547)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #39547

Changelog: [Internal]

Differential Revision: D49437443

fbshipit-source-id: 296e2ae12b357a014513b4d7e2f1b8f26655fb54
  • Loading branch information
christophpurrer authored and facebook-github-bot committed Sep 19, 2023
1 parent c4dbc0a commit fb92420
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ import type {TurboModule} from '../../TurboModule/RCTExport';

import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry';

export type SourceCodeConstants = {|
scriptURL: string,
|};

export interface Spec extends TurboModule {
+getConstants: () => {|
scriptURL: string,
|};
+getConstants: () => SourceCodeConstants;
}

const NativeModule = TurboModuleRegistry.getEnforcing<Spec>('SourceCode');
let constants = null;

const NativeSourceCode = {
getConstants(): {|
scriptURL: string,
|} {
getConstants(): SourceCodeConstants {
if (constants == null) {
constants = NativeModule.getConstants();
}
Expand Down

0 comments on commit fb92420

Please sign in to comment.