无法解析文件的所有参数

Can't resolve all parameters for File

我正在尝试实施 https://ionicframework.com/docs/native/file-transfer/

因此我需要安装 https://ionicframework.com/docs/native/file/

当我在服务中使用 "File" 时,出现错误:

无法解析文件的所有参数:(?, ?, ?, ?, ?)。

我知道问号可能类似于循环引用,但我从未在其他任何地方使用过我的服务,之前也没有使用过 "File"。

import {Injectable} from '@angular/core';
import {File} from "@ionic-native/file";
import { FileTransfer, FileTransferObject } from '@ionic-native/file-transfer';

@Injectable()
export class ImageService {

  constructor(private file: File, private transfer: FileTransfer) {

  }

  public getImagesOfSchedule() {
    const fileTransfer: FileTransferObject = this.transfer.create();
    const url = 'http://techbooster.be/wp-content/uploads/2017/11/logo-long-white.png';
    fileTransfer.download(url, this.file.dataDirectory + 'file.pdf').then((entry) => {
      console.log('download complete: ' + entry.toURL());
    }, (error) => {
      // handle error
    });
  }

}

app.module.ts

providers: [
    StatusBar,
    AuthenticationService,
    ScheduleService,
    ToastService,
    StorageService,
    FacebookService,
    GoogleService,
    ImageService,
    Facebook,
    GooglePlus,
    PushService,
    File, <----------------
    FileTransfer, <--------------
    Push,
    ScreenOrientation,
    {
      provide: HttpService,
      useFactory: HttpFactory,
      deps: [XHRBackend, RequestOptions]
    },
    {
      provide: HttpNoAuthService,
      useFactory: HttpFactory,
      deps: [XHRBackend, RequestOptions]
    },
    SplashScreen,
    {provide: ErrorHandler, useClass: IonicErrorHandler}

好的,我发现 app.module.ts 中自动导入的文件 class 不是:

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

而是一些标准 "lib.es6.d.ts" 自动导入。

因此请确保导入正确 "File" class!