Question on declarations generation
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 30/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- cpp, objective-c, typescript
- Lĩnh vực
- tooling
Hướng nghiên cứu
Bắt đầu với metadata-generator/src/TypeScript/DefinitionWriter.cpp quanh dòng 862 và so sánh việc đánh giá kiểu của nó với các khai báo header Objective-C và ios.d.ts được tạo như minh họa ở đây. Xác định xem các header đầu vào có cần thay đổi hay không, hoặc liệu generator có làm mất các kiểu protocol hay không; việc hoàn thành được đánh dấu bằng một chẩn đoán rõ ràng và các kiểu đối số và kiểu trả về được giữ lại chính xác thay vì NSObject.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hello and thanks for your work.
I have a question regarding the generation of ios typescript declarations hoping to be in the right place.
We're using a robovm based toolchain to build a native library for iOS from Java-code. This toolchain emits header files in the following (shortened) form:
@protocol Option
-(NSString *) optionId;
-(NSString *) type;
@end
typedef NSObject<Option> Option;
@protocol Info
-(NSArray<NSObject<Option> *> *) getOptions;
@end
typedef NSObject<Info> Info;
the (shortened) declarations in ios.d.ts are
interface Option {
optionId(): string;
type(): string;
}
declare var Option: {
prototype: Option;
};
interface Info {
getOptions(): NSArray<NSObject>;
}
declare var Info: {
prototype: Info;
};
You may notice that the returned Array of getOptions is typed with NSObject instead of Option, which is the reason for this writing.
In fact are all argument- and return- types of functions which are defined by our headers typed with NSObject instead of the type which it should be.
After digging a while i understand that the types are evaluated in that function
https://github.com/NativeScript/ios/blob/main/metadata-generator/src/TypeScript/DefinitionWriter.cpp#L862
which might be wrong since it's been a while that i read some cpp code.
I assume that this codes falls back to NSObject if it cannot determine the correct type.
Note, that if i manually adjust the types in ios.d.ts everything works fine.
So basically my questions:
- Are our input (the header files) missing something or do they have to be different soemhow to get beter outcomes?
- If not would it be possible to patch the generator?
- Am i totally wrong here?
Cheers and again thanks for your work.
legion
- Ngôn ngữ chính
- JavaScript
- Star
- 150
- Fork
- 43
- Merge trung bình
- 3 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 22
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.
Issue khác của NativeScript/ios
-
isImplementedInClass leaks the losing sample instance on re-entrant or racing cache population Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 38/100
NativeScript/ios#459 · 1 bình luận ·
-
worker.terminate() is a no-op during entry evaluation, and terminating there wedges teardown Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
NativeScript/ios#445 ·
-
Độ khó 3/5 3-5 ngày Mức phù hợp với người mới 66/100
NativeScript/ios#414 ·
-
question
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 34/100
NativeScript/ios#364 · 2 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
NativeScript/ios#355 ·
Tất cả issue của NativeScript/ios
Issue tương tự
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
babalae/bettergi-scripts-list#3674 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
vadimdemedes/ink#1029 ·
-
code-quality refactoring
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
langchain-ai/deepagents#6450 ·
-
optimization optimization:agents-md-curator
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
githubnext/gh-aw-cao#13143 ·