无法在打字稿中初始化地理阵列对象

时间:2017-04-11 10:39:23

标签: typescript firebase ionic2 geofire

我正在使用typescriptimport { Component, Inject } from '@angular/core'; import { AngularFire, FirebaseListObservable, FirebaseApp } from 'angularfire2'; import { GeoFire } from 'geofire'; constructor(public af: AngularFire, @Inject(FirebaseApp) firebaseApp: firebase.app.App) { var firebaseRef = firebaseApp.database().ref(); var geofire = new GeoFire(firebaseRef); }

上周我在我的应用中集成了 Firebase ,效果很好。现在我想整合 geofire ,但我无法初始化地理对象的实例。

我的 MainSearchPage类:

ionic-app-script 1.3.1,
typescript 2.0.6,
firebase 3.7.5,
angularfire 2.0.0-beta.8,
geofire 4.1.2,

但我总是收到以下错误:

  

./MainSearchPage类中的错误MainSearchPage_Host - 由以下原因导致: WEBPACK_IMPORTED_MODULE_7_geofire .GeoFire不是构造函数

版本:

func <- function(data, col){
   data[,':='(cum_wt = cumsum(eval(as.name(col))))][] # calc the cumulative sum
  return(data)
}

我将不胜感激。

1 个答案:

答案 0 :(得分:0)

尝试像这样导入Geofire

import * as GeoFire from "geofire";