0

I'm updating an existing plugin in order to make it compatible with the upcoming nativescript release.

All references to the tns-core-modules package have been replaced with @nativescript/core.

The released documentation says that the new libraries should be retro-compatible with older versions. Unfortunately in this case something must have changed (related to the view lifecycle), and the plugin is not 100% working.

That's why I attempted a full migration of it's dependencies, but the build process was not possible due to some errors:

node_modules/@nativescript/core/ui/frame/index.d.ts:494:38 - error TS2304: Cannot find name 'ModuleContext'.

494 export function reloadPage(context?: ModuleContext): void;

...

map-view.ios.ts:80:40 - error TS2304: Cannot find name 'WeakRef'.

80     public static initWithOwner(owner: WeakRef<MapView>): MapViewDelegateImpl {
node_modules/@nativescript/core/ui/styling/style/index.d.ts:31:39 - error TS2304: Cannot find name 'WeakRef'.

31     constructor(ownerView: ViewBase | WeakRef<ViewBase>);

I can build the plugin by setting skipLibCheck: true in tsconfig.json. It makes the plugin compile, but the problem comes out later at runtime. So it must be solved to complete the migration.

Any hints?

Thank you!

funder7
  • 1,622
  • 17
  • 30

1 Answers1

0

Maybe it's not the 100% recommended solution, but in case that the same problem does happen to you, add this line to your tsconfig.json:

        "types": [
            "@nativescript/core",
        ],
funder7
  • 1,622
  • 17
  • 30