LioMir
LioMir

Reputation: 33

firebase.User in firebase version 9

I'm writing a new app with React, typescript and firebase. I'm working on the AuthContext and in a tutorial I found I see these lines:

import firebase from "firebase/app";

const [user, setUser] = useState<firebase.User | null>(null);

 

But the import import firebase from "firebase/app"; does not exist on firebase 9 and I can't find the equivalent of firebase.User

Can anyone help?

Upvotes: 2

Views: 431

Answers (2)

scipilot
scipilot

Reputation: 7447

Also, if you get

TS1484: 'User' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled.

then you should use this format

import { type User } from 'firebase/auth'

Upvotes: 0

AyseAsude
AyseAsude

Reputation: 581

I am not familiar with React and AuthContext but maybe this can help. This is how User type can be imported in typescript and in Firebase v9:

import { User } from "firebase/auth";

Upvotes: 3

Related Questions