JS ERROR TypeError: Attempted to assign to readonly property.
gintsmurans opened this issue · comments
Environment
✔ Getting NativeScript components versions information...
✔ Component nativescript has 6.7.8 version and is up to date.
✔ Component tns-core-modules has 6.5.10 version and is up to date.
✔ Component @nativescript/core has 6.5.10 version and is up to date.
✔ Component tns-android has 6.5.3 version and is up to date.
✔ Component tns-ios has 6.5.2 version and is up to date.
Describe the bug
I am trying to extend a class in typescript thats written in swift, but nothing I do seems to be working. To make it a bit easier to understand I put this example in ts file, and I still get the same error:
class Delegate extends UIResponder {
public static ObjCProtocols = [UIApplicationDelegate];
applicationDidReceiveRemoteNotification(application: UIApplication, userInfo: NSDictionary<string, any>) {
}
}
This is the full error:
***** Fatal JavaScript exception - application has been terminated. *****
Native stack trace:
1 0x104d9d62e NativeScript::reportFatalErrorBeforeShutdown(JSC::ExecState*, JSC::Exception*, bool)
2 0x104def524 -[TNSRuntime executeModule:referredBy:]
3 0x104639ad3 main
4 0x10a4fa575 start
JavaScript stack trace:
__(file: node_modules/tslib/tslib.es6.js:26:25)
at __extends(file: node_modules/tslib/tslib.es6.js:27:79)
at file: app/services/player/player.ts:6:23
at ./services/player/player.ts(file: app/services/player/player.ts:6:23)
at __webpack_require__(file: app/webpack/bootstrap:74:0)
at ../node_modules/ts-loader/index.js?!../node_modules/vue-loader/lib/index.js?!./pages/player/PlayerPage.vue?vue&type=script&lang=ts&(file: app/pages/player/PlayerPage.vue?fcac:32:0)
at __webpack_require__(file: app/webpack/bootstrap:74:0)
at ./pages/player/PlayerPage.vue?vue&type=script&lang=ts&(file: app/pages/player/PlayerPage.vue?c0a1:1:0)
at __webpack_require__(file: app/webpack/bootstrap:74:0)
at ./pages/player/PlayerPage.vue(file: app/pages/player/PlayerPage.vue:1:0)
at __webpack_require__(file: app/webpack/bootstrap:74:0)
at ./routes/routes.js(file: app/routes/routes.js:1:0)
at __webpack_require__(file: app/webpack/bootstrap:74:0)
at ../node_modules/ts-loader/index.js?!../node_modules/vue-loader/lib/index.js?!./components/App.vue?vue&type=script&lang=ts&(file: app/components/App.vue?05f4:9:0)
at __webpack_require__(file:///app/runtime.j<…>
JavaScript error:
file: node_modules/tslib/tslib.es6.js:26:25: JS ERROR TypeError: Attempted to assign to readonly property.
(CoreFoundation) *** Terminating app due to uncaught exception 'NativeScript encountered a fatal error: TypeError: Attempted to assign to readonly property.
at
__(file: node_modules/tslib/tslib.es6.js:26:25)
at __extends(file: node_modules/tslib/tslib.es6.js:27:79)
at file: app/services/player/player.ts:6:23
at ./services/player/player.ts(file: app/services/player/player.ts:6:23)
at __webpack_require__(file: app/webpack/bootstrap:74:0)
at ../node_modules/ts-loader/index.js?!../node_modules/vue-loader/lib/index.js?!./pages/player/PlayerPage.vue?vue&type=script&lang=ts&(file: app/pages/player/PlayerPage.vue?fcac:32:0)
at __webpack_require__(file: app/webpack/bootstrap:74:0)
at ./pages/player/PlayerPage.vue?vue&type=script&lang=ts&(file: app/pages/player/PlayerPage.vue?c0a1:1:0)
at __webpack_require__(file: app/webpack/bootstrap:74:0)
at ./pages/player/PlayerPage.vue(file: app/pages/player/PlayerPage.vue:1:0)
at __webpack_require__(file: app/webpack/bootstrap:74:0)
at ./routes/routes.js(file: app/routes/routes.js:1:0)
at __webpack_require__(file: app/webpack/bootstrap:74:0)
at ../node_modules/ts-loader/index.js?!../node_modules/<…>
NativeScript caught signal 6.
Native Stack:
1 0x104dee171 sig_handler(int)
2 0x10a9e25fd _sigtramp
3 0x104d0c768
4 0x10a75cc45 abort
5 0x109a205b1 __cxa_bad_cast
6 0x109a2074d default_unexpected_handler()
7 0x107adfa9d _objc_terminate()
8 0x109a2c65e std::__terminate(void (*)())
9 0x109a2c102 __cxxabiv1::exception_cleanup_func(_Unwind_Reason_Code, _Unwind_Exception*)
10 0x107adf86a _objc_exception_destructor(void*)
11 0x104d9db6f NativeScript::reportFatalErrorBeforeShutdown(JSC::ExecState*, JSC::Exception*, bool)
12 0x104def524 -[TNSRuntime executeModule:referredBy:]
13 0x104639ad3 main
14 0x10a4fa575 start
JS Stack:
Tried this: NativeScript/nativescript-dev-webpack#70 (comment) didn't help.
Tried pasting "JSObject" from https://docs.nativescript.org/core-concepts/ios-runtime/how-to/objc-subclassing#typescript-support - same thing as previous. Maybe this is some configuration issue that I am not aware of?
Was this solved?
Its a good question, we didnt find solution.
+1