RCTExport.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. *
  7. * @flow strict
  8. * @format
  9. */
  10. 'use strict';
  11. /**
  12. * NOTE: This is React Native specific export type.
  13. *
  14. * DEPRECATED_RCTExport is an interface type that allows native code generation
  15. * for React Native native modules. It exists as a hint to the codegen tool that
  16. * any interface that extends it needs to be codegen'ed. Example usage:
  17. *
  18. * export interface RCTFoobar extends DEPRECATED_RCTExport<void> {}
  19. *
  20. * Native definition for RCTFoobar will then be generated.
  21. *
  22. * The type param T is a placeholder for future codegen hinting, like versioning
  23. * information, native base classes, etc. For now, simply use `void` type as
  24. * there's nothing to give hint about.
  25. *
  26. * NOTE: This export is deprecated. Please use TurboModule.
  27. */
  28. // eslint-disable-next-line no-unused-vars
  29. export interface DEPRECATED_RCTExport<T: void = void> {
  30. +getConstants?: () => {...};
  31. }
  32. export interface TurboModule extends DEPRECATED_RCTExport<void> {}