Question on declarations generation
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 30/100
- Tipo di issue
- Bug
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- cpp, objective-c, typescript
- Ambito
- tooling
Direzione di ricerca
Inizia da metadata-generator/src/TypeScript/DefinitionWriter.cpp intorno alla riga 862 e confronta la sua valutazione dei tipi con le dichiarazioni degli header Objective-C e l'ios.d.ts generato mostrato qui. Determina se è necessario modificare gli header di input oppure se il generatore perde i tipi dei protocolli; il completamento deve essere contrassegnato da una diagnosi chiara e dalla corretta conservazione dei tipi degli argomenti e di ritorno invece di NSObject.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- JavaScript
- Stelle
- 150
- Fork
- 43
- Merge medio
- 3g 10h
- PR unite (30g)
- 22
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.
Altre issue di NativeScript/ios
-
isImplementedInClass leaks the losing sample instance on re-entrant or racing cache population Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 38/100
NativeScript/ios#459 · 1 commento ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
NativeScript/ios#445 ·
-
Difficoltà 3/5 3-5 giorni Idoneità per principianti 66/100
NativeScript/ios#414 ·
-
question
Difficoltà 4/5 3-5 giorni Idoneità per principianti 34/100
NativeScript/ios#364 · 2 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
NativeScript/ios#355 ·
Tutte le issue di NativeScript/ios
Issue simili
-
ai-observability bug team/ai-observability
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
AllTheMods/ATM-10-L#19 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
SignalK/n2k-signalk#345 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
JuliaPluto/PlutoPlotly.jl#72 ·