이전 Javascript firebase 클래스를 Typescript로 변환하려고하는데 다음과 같은 경고 / 오류가 나타납니다. 'Firebase'유형에 'auth'속성이 없습니다.
문제를 찾아 보았지만 명확한 답을 찾을 수 없습니다. 아무도 내가 뭘 잘못하고 있는지 알고 있습니까?
class Firebase {
constructor() {
app.initializeApp(config)
this.auth = app.auth()
}
doSignInWithGoogle = () => this.auth.signInWithPopup(this.googleProvider)
}
어떤 도움이라도 대단히 감사합니다!
Firebase는 아래와 같이 Typescript로 구성 할 수 있습니다. 클래스의 속성 app
과 auth
의도 한 디자인에 공개 또는 따라 개인 일 수도있다.
import * as firebase from 'firebase/app'
import 'firebase/auth'
class Firebase {
app: firebase.app.App
auth: firebase.auth.Auth
constructor() {
// https://firebase.google.com/docs/reference/js/firebase.app.App
this.app = firebase.initializeApp(config)
this.auth = firebase.auth(this.app)
}
public signInWithGooglePopup(): Promise<firebase.auth.UserCredential> {
// https://firebase.google.com/docs/reference/js/firebase.auth.Auth#sign-inwith-popup
return this.auth.signInWithPopup(this.googleProvider)
}
}
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다