Typescript: Error TS2304


#1

Hi, i’m having the next error when i run the app (browser or phone): Error TS2304: Cannot find name ‘cordova’.
I installed the cordova-plugin-file, ion-native and the typings for the file and fileSystem.
Before the typings i got the error in visual studio and typescript, now only typescript.

import {App, Platform} from 'ionic-angular';
import {File} from 'ionic-native';
import {TabsPage} from './pages/tabs/tabs';
import {DataService} from './data.service';

@App({
template: '',
providers: [DataService],
config: {}
})
export class MyApp {
rootPage : any = TabsPage;

constructor(platform: Platform, dataService : DataService) {
    platform.ready().then(() => {
        StatusBar.styleDefault();
        File.listDir(cordova.file.dataDirectory, '').then((data) => document.write(data), (data)=> document.write('Error: '+JSON.stringify(data)));
    });
}
}

The code is just for check if the plugin works. The error is because of cordova.file.dataDirectory.


#2

Did you ever resolve this issue? I’m having the same issue.