-
Notifications
You must be signed in to change notification settings - Fork 926
Type definitions no longer work after updating from 4.8.0 to 4.8.1 #388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hey there! I couldn't figure out what this issue is about, so I've labeled it for a human to triage. Hang tight. |
4.8.1 was a refactor of the typings and you now pull your imports from @firebase: import { FirebaseApp } from '@firebase/app-types';
import { FirebaseAuth } from '@firebase/auth-types';
import { FirebaseDatabase } from '@firebase/database-types';
import { FirebaseMessaging } from '@firebase/messaging-types';
import { FirebaseStorage } from '@firebase/storage-types';
import { FirebaseFirestore } from '@firebase/firestore-types'; |
Thanks! It seems like there's a lot that really needs to be documented, but that helped resolve the issues for me. |
@myspivey That seems like a nasty breaking change for a .0.1 release! And without any docs too. Not good! Especially as it breaks Angularfire2. |
@myspivey where do I find auth()? const auth = firebase.auth();
auth.fetchProvidersForEmail(mail).then(p => { console.log(p); });
auth.sendPasswordResetEmail(mail).then(() => { in 481, I can't find auth() in FirebaseApp or FirebaseAuth. Do you know of any sample Angular program that we can refer to to see how to reference firebase? |
This change was really surprising for a patch version bump. Here are the following things I had to do to make it work (documenting here in case it helps someone): // include firebase core
import * as firebase from 'firebase/app'
// include services that you want
import 'firebase/auth'
import 'firebase/database'
// servervalue timestamp is here
import { ServerValue } from '@firebase/database'
// types are in these packages
import { FirebaseApp } from '@firebase/app-types'
import { FirebaseAuth } from '@firebase/auth-types'
import { DataSnapshot, Reference, FirebaseDatabase } from '@firebase/database-types'
const app: FirebaseApp = firebase.initializeApp(options)
const db: FirebaseDatabase = app.database()
const ref: Reference = app.database().ref('/some/path')
app.database().ref('/some/path').set(ServerValue.Timestamp) |
@kksharma1618 but how do I get the auth object? Refer to my post above, at |
Also, you can import |
@alexfung888 Developers will most likely fix 4.8.1 issues soon enough. Till then I intend to stick with 4.8.0.
was clearing firebase.auth() for me in 4.8.0. I had to remove it to get firebase.auth() working again. Not sure if that helps in your case. |
How to get the following code to work:
This code will not work, because the implementation of DocumentReference is not in the I've already killed a lot of time to figure out how to use individual packages with types. |
@0x6368656174 It's important to remember that the |
I'm still getting the same issue on 4.10.1. Is app-types meant to be a peerDependency? If it's just for TypeScript projects, why force non-TS projects to see a warning every time instead of making it an optionalDependency? |
I just ran into this problem as well. The most frustrating part is that the error I got was extremely unhelpful. Either The code below solved the problem for me: import firebase from '@firebase/app';
import '@firebase/firestore';
import { DocumentReference, Query } from '@firebase/firestore-types';
function Foo(ref: DocumentReference|Query)
if (ref instanceof firebase.firestore.DocumentReference) {
// ...
}
// ...
} |
[REQUIRED] Describe your environment
[REQUIRED] Describe the problem
Steps to reproduce:
Install firebase and try to use it with TypeScript 2.5.3, TypeScript 2.6.2, or Angular CLI.
Relevant Code:
Build fails with
error TS2503: Cannot find namespace 'firebase'.
(red squiggly under thefirebase
immediately afterballs
).Edit: This may be related to or the same issue as #387. However, I do see @firebase/app-types and a bunch of other @firebase packages correctly installed, so I dunno.
The text was updated successfully, but these errors were encountered: