Question on declarations generation
維護者通常 2 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 30/100
- Issue 類型
- 缺陷
- 描述清晰度
- 需要釐清
- 活躍度
- 停滯
- 技術堆疊
- cpp, objective-c, typescript
- 領域
- tooling
研究方向
從 metadata-generator/src/TypeScript/DefinitionWriter.cpp 第862行附近開始,將其型別評估與這裡所示的 Objective-C 標頭宣告和產生的 ios.d.ts 進行比較。判定是否需要修改輸入標頭,或是產生器遺失了協定型別;完成的標誌應是明確的診斷,以及正確保留引數型別和回傳型別,而不是 NSObject。
由索引模型根據 Issue 內容生成。
描述
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
- 主要語言
- JavaScript
- 星號
- 150
- 分支
- 44
- 平均合併
- 3 天 23 小時
- 30 天內合併 PR
- 19
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
NativeScript/ios 的其他 Issue
-
interop.FunctionReference function passed as a block, then as a function pointer, asserts可能已有人在做 @edusperoni 於 1 天前認領。 未關閉
難度 4/5 3-5 天 新手友好度 22/100
NativeScript/ios#503 ·
維護者通常 2 天內回覆
-
難度 5/5 一週以上 新手友好度 38/100
NativeScript/ios#459 · 1 則留言 ·
維護者通常 2 天內回覆
-
難度 3/5 3-5 天 新手友好度 66/100
NativeScript/ios#414 ·
維護者通常 2 天內回覆
-
question
難度 4/5 3-5 天 新手友好度 34/100
NativeScript/ios#364 · 2 則留言 ·
維護者通常 2 天內回覆
-
難度 4/5 3-5 天 新手友好度 35/100
NativeScript/ios#355 ·
維護者通常 2 天內回覆
相似的 Issue
-
chore v2
難度 2/5 1-3 小時 新手友好度 78/100
modelcontextprotocol/servers#5115 ·
維護者通常 1 天內回覆
-
beginner bug good first issue
難度 1/5 1 小時以內 新手友好度 85/100
philaconvalley/website#168 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 66/100
druxt/umami.demo.druxtjs.org#527 ·
維護者通常 9 天內回覆
-
難度 2/5 1-3 小時 新手友好度 62/100
NuSkooler/enigma-bbs#907 ·
維護者通常 1 天內回覆
-
documentation good first issue
難度 2/5 1-3 小時 新手友好度 72/100