Skip to content

Codegen fails when using generic or deprecated CodegenTypes.EventEmitter in TurboModule interfaces #59

Description

@adeelcheeema

Before submitting a new issue

  • I tested using the latest version of the library, as the bug might be already fixed.
  • I tested using a supported version of react native.
  • I checked for possible duplicate issues, with possible answers.

Bug summary

Image

When defining a TurboModule interface that includes an EventEmitter with a generic type or using the deprecated CodegenTypes import, React Native Codegen throws an error and stops generating native bindings.

UnsupportedModulePropertyParserError: Module NativeReactNativeScanner:
TypeScript interfaces extending TurboModule must only contain
'FunctionTypeAnnotation's or non nullable 'EventEmitter's.
Property 'onBarcodeScanned' refers to a 'TSTypeReference' or 'TSAnyKeyword'.

✅ Expected behavior

Codegen should:

Either ignore or warn about deprecated internal imports (CodegenTypes),

Or provide a clearer message explaining the correct import path for EventEmitter.

🧩 Actual behavior

Codegen throws a fatal error, preventing native module generation.

Library version

2.0.1"

Environment info

System:
  OS: macOS 26.0.1 (Apple M1)
  CPU: 8-core ARM64, 8 GB RAM
Binaries:
  Node: 20.19.5
  Yarn: 4.6.0
  npm: 10.8.2
  Watchman: 2025.04.28.00
Managers:
  CocoaPods: 1.16.2
SDKs:
  iOS: 26.0 (Xcode 26.0.1 / 17A400)
  Android: Not Found
npmPackages:
  react: 19.0.0
  react-native: 0.79.2
  @react-native-community/cli: 18.0.0
Android/iOS:
  Hermes: enabled
  New Architecture: enabled

Steps to reproduce

Steps to Reproduce

Add the library to your React Native project:

Run the Android build (this triggers Codegen automatically):

During the build step, Codegen throws the error.

Reproducible example repository

https://github.com/pushpender-singh-ap/react-native-scanner

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions