0
import { File } from '@ionic-native/file/ngx';

I can’t use the class File from cordova-plugin-file in my application cause there is another interface from JavaScript also called File.

This name conflict impedes my app to access the cordova-plugin-file functions I want.

File from JavaScript has this description : “ interface File Provides information about files and allows JavaScript in a web page to access their content.”.

File from cordova-plugin-file should (alias) const File: FileOriginal import File 'File' is declared but its value is never read

Here is my code :

import { File } from '@ionic-native/file/ngx';
export class Tab1Page {
constructor(public file: File) {}
...
}
  • 1
    If i got you right you have naming collision during import. To resolve this you can import using alias https://stackoverflow.com/questions/39282253/how-can-i-alias-a-default-import-in-javascript. – validname Dec 26 '20 at 10:50
  • 1
    thanks mate, you guided me in the right direction. Issue is resolved. – Hrushikesh Sawant Dec 27 '20 at 08:15

1 Answers1

0

Just so that it helps someone. Workaround was to declare cordova-plugin-file outside constructor.

import { File as cordova_file } from '@ionic-native/file/ngx';
private file: typeof cordova_file
constructor(