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]

Reviewed By: rshest

Differential Revision: D49437443

fbshipit-source-id: 200f8b886a3a18aec6c9455e931e25634aca2149
  • Loading branch information
christophpurrer authored and facebook-github-bot committed Sep 20, 2023
1 parent f31dada commit 0789736
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 0789736

Please sign in to comment.