我们正在开发离子2平台上的开源应用程序,有人在项目中添加了Firebase,我做了拉取请求,现在当我尝试运行应用程序时,我收到此错误。它可能与某些Firebase依赖项或包有关。我该如何解决这个问题?
几乎与Firebase相关的每一行都会出现此错误。例如:
export declare function _getAuthBackend(app: firebase.app.App): FirebaseSdkAuthBackend;
这是代码:
import * as firebase from 'firebase';
import { Observable } from 'rxjs/Observable';
export declare abstract class AuthBackend {
abstract authWithCustomToken(token: string): Promise<FirebaseAuthState>;
abstract authAnonymously(options?: any): Promise<FirebaseAuthState>;
abstract authWithPassword(credentials: EmailPasswordCredentials): Promise<FirebaseAuthState>;
abstract authWithOAuthPopup(provider: AuthProviders, options?: any): Promise<firebase.auth.UserCredential>;
abstract authWithOAuthRedirect(provider: AuthProviders, options?: any): Promise<void>;
abstract authWithOAuthToken(credentialsObj: firebase.auth.AuthCredential, options?: any): Promise<FirebaseAuthState>;
abstract onAuth(): Observable<FirebaseAuthState>;
abstract getAuth(): FirebaseAuthState;
abstract unauth(): Promise<void>;
abstract createUser(credentials: EmailPasswordCredentials): Promise<FirebaseAuthState>;
abstract getRedirectResult(): Observable<firebase.auth.UserCredential>;
}
export declare enum AuthProviders {
Github = 0,
Twitter = 1,
Facebook = 2,
Google = 3,
Password = 4,
Anonymous = 5,
Custom = 6,
}
export declare enum AuthMethods {
Popup = 0,
Redirect = 1,
Anonymous = 2,
Password = 3,
OAuthToken = 4,
CustomToken = 5,
}
export interface AuthConfiguration {
method?: AuthMethods;
provider?: AuthProviders;
scope?: string[];
}
export interface FirebaseAuthState {
uid: string;
provider: AuthProviders;
auth: firebase.User;
expires?: number;
github?: firebase.UserInfo;
google?: firebase.UserInfo;
twitter?: firebase.UserInfo;
facebook?: firebase.UserInfo;
anonymous?: boolean;
}
export declare function authDataToAuthState(authData: firebase.User, providerData?: firebase.UserInfo): FirebaseAuthState;
export declare function stripProviderId(providerId: string): string;
export interface EmailPasswordCredentials {
email: string;
password: string;
}
答案 0 :(得分:1)
可能缺少以下任何配置步骤。
firebase
添加到tsconfig
导入模块
import { AngularFireModule } from 'angularfire2';
@NgModule({
declarations: [...],
imports: [
...,
AngularFireModule.initializeApp(firebaseConfig)
],
...
3.您可能需要运行
typings install
注意: -
const firebaseConfig = {
apiKey: "<your-key>",
authDomain: "<your-project-authdomain>",
databaseURL: "<your-database-URL>",
storageBucket: "<your-storage-bucket>"
}