Codegen chokes on imported types
Aperta
@dmytrorykun ci sta già lavorando.
Dal 30/10/2023.
Needs: React Native Team Attention
Never gets stale
Tech: Codegen
Type: New Architecture
- Lingua principale
- C++
- Stelle
- 127k
- Fork
- 25.3k
- Merge medio
- 1g 23h
- PR unite (30g)
- 4
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Valutazione
Questa issue non è ancora stata valutata.