-
Notifications
You must be signed in to change notification settings - Fork 25k
Description
Description
I'm developing Turbo Native Module, which utilizes Event Emitter JS Spec.
The Event Emitter JS Spec was cherry-picked in 0.76.2, so applications using rn version lower than 0.76.2 would break build when they try to build with my library.
So I decided to include generated codes, as documented in codegen documentation, by setting includesGeneratedCode flag to true.
What I expect is as we offers generated code with our library, codegen doesn't need to(and must not) run by application level for our library's JS spec because in the codegen documentation it says:
No need to worry about Codegen version mismatch between what is used by the app, and what was used during library development.
But when I try to build application running on rn lower than 0.76.2 (via running npx @react-native-community/cli codegen) with included generated code, it still complains about the UnsupportedModulePropertyParserError(detailed error log in below).
Am I misunderstanding the includesGeneratedCode option?
Steps to reproduce
- Clone https://github.com/wjaykim/rn-codegen-issue-reproducer
- Run
yarn install - Run
npx @react-native-community/cli codegen
React Native Version
0.74.6 - 0.76.1
Affected Platforms
Runtime - iOS, Build - MacOS
Areas
Codegen
Output of npx react-native info
System:
OS: macOS 15.2
CPU: (10) arm64 Apple M1 Pro
Memory: 324.94 MB / 32.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 20.18.0
path: ~/.nvm/versions/node/v20.18.0/bin/node
Yarn:
version: 1.22.22
path: ~/.nvm/versions/node/v20.18.0/bin/yarn
npm:
version: 10.8.2
path: ~/.nvm/versions/node/v20.18.0/bin/npm
Watchman:
version: 2024.12.02.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.16.2
path: /Users/user/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.2
- iOS 18.2
- macOS 15.2
- tvOS 18.2
- visionOS 2.2
- watchOS 11.2
Android SDK: Not Found
IDEs:
Android Studio: 2024.1 AI-241.18034.62.2412.12266719
Xcode:
version: 16.2/16C5032a
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.13
path: /usr/bin/javac
Ruby:
version: 3.3.5
path: /Users/user/.rbenv/shims/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.74.6
wanted: 0.74.6
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: Not found
newArchEnabled: false
Stacktrace or Logs
UnsupportedModulePropertyParserError: Module Native***Module: TypeScript interfaces extending TurboModule must only contain 'FunctionTypeAnnotation's. Property 'on***' refers to a 'TSTypeReference'.
at throwIfModuleTypeIsUnsupported (/Users/user/test/node_modules/@react-native/codegen/lib/parsers/error-utils.js:163:11)
at buildPropertySchema (/Users/user/test/node_modules/@react-native/codegen/lib/parsers/parsers-commons.js:472:3)
at /Users/user/test/node_modules/@react-native/codegen/lib/parsers/parsers-commons.js:705:24
at guard (/Users/user/test/node_modules/@react-native/codegen/lib/parsers/utils.js:26:14)
at /Users/user/test/node_modules/@react-native/codegen/lib/parsers/parsers-commons.js:702:14
at Array.map (<anonymous>)
at buildModuleSchema (/Users/user/test/node_modules/@react-native/codegen/lib/parsers/parsers-commons.js:699:6)
at /Users/user/test/node_modules/@react-native/codegen/lib/parsers/parsers-commons.js:522:9
at guard (/Users/user/test/node_modules/@react-native/codegen/lib/parsers/utils.js:26:14)
at buildSchemaFromConfigType (/Users/user/test/node_modules/@react-native/codegen/lib/parsers/parsers-commons.js:521:22) {
nodes: [ undefined ]
}
Reproducer
https://github.com/wjaykim/rn-codegen-issue-reproducer
Screenshots and Videos
No response