mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
3a6327a5d9
Summary: Open source this ESLint rule so that we can lint our open source NativeModule specs. Changelog: [Internal] Reviewed By: shergin, cpojer Differential Revision: D23791748 fbshipit-source-id: e44444bc87eaa9dc9b7f2b3ed03151798a35e8a5
39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @flow
|
|
* @format
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
import type {RootTag, TurboModule} from '../RCTExport';
|
|
import * as TurboModuleRegistry from '../TurboModuleRegistry';
|
|
|
|
export interface Spec extends TurboModule {
|
|
// Exported methods.
|
|
+getConstants: () => {|
|
|
const1: boolean,
|
|
const2: number,
|
|
const3: string,
|
|
|};
|
|
+voidFunc: () => void;
|
|
+getBool: (arg: boolean) => boolean;
|
|
+getNumber: (arg: number) => number;
|
|
+getString: (arg: string) => string;
|
|
+getArray: (arg: Array<any>) => Array<any>;
|
|
+getObject: (arg: Object) => Object;
|
|
// eslint-disable-next-line @react-native/codegen/react-native-modules
|
|
+getRootTag: (arg: RootTag) => RootTag;
|
|
+getValue: (x: number, y: string, z: Object) => Object;
|
|
+getValueWithCallback: (callback: (value: string) => void) => void;
|
|
+getValueWithPromise: (error: boolean) => Promise<string>;
|
|
}
|
|
|
|
export default (TurboModuleRegistry.getEnforcing<Spec>(
|
|
'SampleTurboModule',
|
|
): Spec);
|