Codegen chokes on imported types
オープン
@dmytrorykun がすでに取り組んでいます。
2023年10月30日 から。
Needs: React Native Team Attention
Never gets stale
Tech: Codegen
Type: New Architecture
- 主要言語
- C++
- スター
- 127k
- フォーク
- 25.3k
- 平均マージ
- 1日 23時間
- マージ済み PR(30日)
- 4
説明
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
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
評価
この issue はまだ評価されていません。