I am using firebase, including auth, inside my React app with Typescript. So this is in a .tsx file
imported like import UserCredential from 'firebase/auth'
I am trying to apply the type UserCredential to my function argument, like this
const myCallback = (result: UserCredential) => { //function contents }
but I am getting the error "'UserCredential' refers to a value, but is being used as a type here"
However, when I inspect the type-definitions for UserCredential, it is defined as a type. How can it "refer to a value" but clearly be a type? I'd like to be able to use it to type my function argument for the intellisense and consistency, etc. I'm sure there is something I'm missing -so this issue will probably keep coming up unless I can figure out what is wrong. How can I make this work?
using firebase.User
solved my problem
import firebase from 'firebase'
const myCallback = (result: firebase.User) => {
// function contents
}
I hope it works for you