Open jdnichollsc opened 5 years ago
I have the following issue testing decorators:
- error TS2339: Property 'Subscribe' does not exist on type 'typeof eventbus'.
5 const Subscribe = org.greenrobot.eventbus.Subscribe;
And my definition file is:
declare namespace org {
export namespace greenrobot {
export namespace eventbus {
export class EventBus {
public static getDefault(): EventBus;
public post(event: java.lang.Object): void;
public isRegistered(subscriber: java.lang.Object): boolean;
public register(subscriber: java.lang.Object): void;
public unregister(subscriber: java.lang.Object): void;
}
export interface Subscribe {}
}
}
}
Let me know, Thanks in advance
without success testing with a decorator from the android.d.ts:
export function Subscribe<T>(
target: Object,
propertyName: string,
descriptor: TypedPropertyDescriptor<T>
): PropertyDescriptor;
Terminal:
System.err: > Interface implementation must be invoked as a constructor with the
newkeyword.
@EddyVerbruggen do you have experience using EventBus
with NativeScript
or RxJS
would be a better option?
@jdnichollsc No, but have you tried using https://github.com/NativeScript/android-dts-generator to generate those typings?
@EddyVerbruggen thanks! but this issue looks like Android annotations are not supported with NativeScript and It would be awesome using it with TypeScript decorators :)
I understand, but can't really help you with that.
No problem, thanks mate! 👍
Hi @jdnichollsc! Sorry for the late reply, if I understand correctly, you want to extend a Java class and decorate it with a Java annotation. Something like that:
@JavaAnnotation
class JSClass extends JavaClass{
}
If this is the case, currently we do not support setting Java annotations through TypeScript extending of Java classes. This perhaps would not be trivial to support but I'll think it through when working on the above mentioned feature request
Hello guys,
I was reviewing the documentation for Android, but I can't see any example using Android annotations with TypeScript, can you give me any example? otherwise it would be a nice to have!
I want to use
Annotation Type Subscribe
of this Android package: http://greenrobot.org/files/eventbus/javadoc/3.0/ from an extended class ofjava.lang.Object
Any help is really appreciated, I'm creating my first contribution (plugin) for NativeScript and it works perfect from iOS! 👍
Regards, Juan