AuthProvider.ts
const [authStatus, setAuthStatus] = useState<AuthStatus>("FETCHING");
const [user, setUser] = useState<User>();
return (
<AuthContext.Provider
ERROR HERE -> value={{
authStatus,
user,
login: loginHandler,
logout: logoutHandler,
}}
>
{children}
</AuthContext.Provider>
);
Error
TS2322: Type '{ authStatus: "AUTHENTICATED" | "NOT_AUTHENTICATED"; user: User | undefined; login: (user: User) => void; logout: () => void; }' is not assignable to type 'AuthContextType'. Type '{ authStatus: "AUTHENTICATED" | "NOT_AUTHENTICATED"; user: User | undefined; login: (user: User) => void; logout: () => void; }' is not assignable to type '{ login: (user: User) => void; logout: () => void; } & UnauthenticatedUser'. Type '{ authStatus: "AUTHENTICATED" | "NOT_AUTHENTICATED"; user: User | undefined; login: (user: User) => void; logout: () => void; }' is not assignable to type 'UnauthenticatedUser'. Types of property 'authStatus' are incompatible. Type '"AUTHENTICATED" | "NOT_AUTHENTICATED"' is not assignable to type '"NOT_AUTHENTICATED" | "FETCHING"'. Type '"AUTHENTICATED"' is not assignable to type '"NOT_AUTHENTICATED" | "FETCHING"'. Did you mean '"NOT_AUTHENTICATED"'?