Im trying to write a Sign up cloud function in typescript. When i try to call .auth() on my firebase app, it gives me this compilation error Property 'auth' does not exist on type 'FirebaseNamespace'.ts(2339).
Heres the import: import { firebase } from "@firebase/app";
Heres the function:
app.post("/signup", async (req, res) => {
try{
const userJson = {
email: req.body.email,
displayName: req.body.displayName,
password: req.body.password,
confirmPassword: req.body.confirmPassword,
};
const user = await firebase
.auth()
.createUserWithEmailAndPassword(userJson.email, userJson.password)
const displayName: string = user.data()?.displayName;
res.json({ message: `user ${displayName} succesfuly created` });
} catch (error) {
console.log(error);
res.status(500).send(error);
}
});