NativeScript Permissions - Cannot find name 'android'?


I’m using the Spartadigital NativeScript Permissions plugin

I’ve also did :

tns plugin add @spartadigital/nativescript-permissions

And inside the ts file :

import {Permissions} from '@spartadigital/nativescript-permissions';

However when I run tns run android : I get :

node_modules/@spartadigital/nativescript-permissions/,37): error TS2304: Cannot find name 'android'.

node_modules/@spartadigital/nativescript-permissions/,34): error TS2304: Cannot find name 'android'.
node_modules/@spartadigital/nativescript-permissions/permissions.ios.d.ts(24,47): error TS2552: Cannot find name 'NSObject'. Did you mean 'Object'?
node_modules/@spartadigital/nativescript-permissions/permissions.ios.d.ts(24,67): error TS2304: Cannot find name 'CLLocationManagerDelegate'.
node_modules/@spartadigital/nativescript-permissions/permissions.ios.d.ts(26,20): error TS2304: Cannot find name 'CLLocationManagerDelegate'.

Looking at the file , I see that it doesn’t know android :


Nor other IOS objects :

I already have tns-platform-declarations :



Why doesn’t it recognize those keywords and how can I fix it ?




ANswered by Brad here :

I copied those declarations to the root reference.d.ts and it works.


This is a bit odd though. The TS compiler shouldn’t have any business with how the definitions are composed within your node_modules. Even though this seems like the solution, could you share the contents of your tsconfig.json?


@jogboms ts.config is in the question ( at the bottom).

Also discussed here :

it’s becuase of the root : reference.d.ts


Well if thats the case then. I just read the github convo. As Nick rightly said, all plugins should only have compiled js files. Very well then. :+1:


It wasn’t on a typical TS file. but d.ts file. who had incorrect path for other d.ts location. ( just like core-modes had). :slight_smile: