Codegen chokes on imported types
Đang mở
@dmytrorykun đang làm issue này rồi.
Từ ngày 30/10/2023.
Needs: React Native Team Attention
Never gets stale
Tech: Codegen
Type: New Architecture
- Ngôn ngữ chính
- C++
- Star
- 127k
- Fork
- 25.3k
- Merge trung bình
- 1 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 4
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Đánh giá
Issue này chưa được đánh giá.