Reputation: 148524
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/permissions.android.d.ts(2,37): error TS2304: Cannot find name 'android'.
node_modules/@spartadigital/nativescript-permissions/permissions.android.d.ts(3,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 :
Question:
Why doesn't it recognize those keywords and how can I fix it ?
Upvotes: 2
Views: 3723
Reputation: 143
an easy answer would be to add declare var android
to the top of the typescript file (under imports) you are calling it in. NativeScript knows where to get android from once its compiled.
Upvotes: 1
Reputation: 6167
You should add the tns-platform-declarations
module to your project, this will give you the typings for the native namespaces, classes, etc and enable intellisense also for what is provided by this module.
https://www.npmjs.com/package/tns-platform-declarations
Upvotes: 4