Skip to content
This repository was archived by the owner on Nov 17, 2022. It is now read-only.

Commit 5550f47

Browse files
authored
Merge pull request #1590 from NativeScript/bektchiev/issue-with-ts-es6
docs: Issue with TS ES6 modules when inheriting from native
2 parents 3290ab3 + e89dbab commit 5550f47

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

docs/core-concepts/ios-runtime/how-to/ObjC-Subclassing.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,19 @@ class JSObject extends NSObject implements NSCoding {
181181

182182
There should be no TypeScript constructor, because it will not be executed. Instead override one of the `init` methods.
183183

184+
> **IMPORTANT NOTICE** Currently this syntax is unsupported when using TypeScript with **ES6 modules**. As a workaround you can
185+
> use the [JavaScript approach](#calling-base-methods-Subclass) by casting the base class to `any` and calling the [extend function](#extend)
186+
> like this:
187+
> ```typescript
188+
const AppDelegate = (UIResponder as any).extend({
189+
applicationDidBecomeActive(application: UIApplication): void {
190+
console.log("applicationDidBecomeActive", application);
191+
}
192+
}, {
193+
protocols: [UIApplicationDelegate]
194+
});
195+
> ```
196+
> For updates regarding this issue you can check [here](https://github.com/NativeScript/ios-runtime/issues/818)
184197
185198
## TypeScript Delegate Example
186199

0 commit comments

Comments
 (0)