Codegen chokes on imported types
Offen
@dmytrorykun arbeitet bereits daran.
Seit 30.10.2023.
Needs: React Native Team Attention
Never gets stale
Tech: Codegen
Type: New Architecture
- Vorherrschende Sprache
- C++
- Sterne
- 127k
- Forks
- 25.3k
- Ø Merge
- 1 T. 23 Std.
- Gemergte PRs (30 T.)
- 4
Beschreibung
Description
It seems codegen currently chokes on types imported from a different module, i.e. consider this example:
// types.ts
export type MyType = {
field: string;
};
// NativeReactNativeMyModule.ts
import type { TurboModule } from 'react-native';
import { TurboModuleRegistry } from 'react-native';
import { type MyType } from './types';
export interface Spec extends TurboModule {
myMethod(arg: MyType): void;
}
export default TurboModuleRegistry.getEnforcing<Spec>('ReactNativeMyModule');
When running the build (for Android on Ubuntu system) the codegen chokes on the method definition saying UnsupportedGenericParserError: Module NativeReactNativeMyModule: Unrecognized generic type 'MyType' in NativeModule spec.
This equivalent code works fine though:
import type { TurboModule } from 'react-native';
import { TurboModuleRegistry } from 'react-native';
export type MyType = {
field: string;
};
export interface Spec extends TurboModule {
myMethod(arg: MyType): void;
}
export default TurboModuleRegistry.getEnforcing<Spec>('ReactNativeMyModule');
React Native Version
v0.72.3
Output of npx react-native info
N/A
Steps to reproduce
N/A
Snack, code example, screenshot, or link to a repository
N/A
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Bewertung
Dieses Issue wurde noch nicht bewertet.