I'm facing an issue while trying to incorporate an iOS delegate in a NativeScript plugin. The error I'm encountering reads as follows:
Terminating app due to uncaught exception 'NativeScript encountered a fatal error: ReferenceError: Can't find variable: __metadata
The original code snippet is as below:
@ObjCClass(SQRDCheckoutControllerDelegate)
export class SquareReader extends NSObject implements SQRDCheckoutControllerDelegate {
/*
iOS delegate implementation here
(source https://docs.connect.squareup.com/payments/readersdk/setup-ios)
*/
}
Upon transpiling, the code reduces down to:
SquareReader = __decorate([
ObjCClass(exports.SQRDCheckoutControllerDelegate),
__metadata("design:paramtypes", [])
], SquareReader);
If I remove the __metadata line, a different error surfaces:
Terminating app due to uncaught exception 'NativeScript encountered a fatal error: Error: Protocol "undefined" is not a protocol object.
Any suggestions on how to tackle this? I've come across instances like nativescript-image-swipe, where the code transpiles successfully without using the __metadata method, raising suspicions on the transpilation process.