Skip to content

Commit 3a62b12

Browse files
authored
improve type safety for useAuth hook with ensureSignedIn (#196)
1 parent cdfcad2 commit 3a62b12

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/components/authkit-provider.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ export const AuthKitProvider = ({ children, onSessionExpired }: AuthKitProviderP
166166
);
167167
};
168168

169+
export function useAuth(options: {
170+
ensureSignedIn: true;
171+
}): AuthContextType & ({ loading: true; user: User | null } | { loading: false; user: User });
172+
export function useAuth(options?: { ensureSignedIn?: false }): AuthContextType;
169173
export function useAuth({ ensureSignedIn = false }: { ensureSignedIn?: boolean } = {}) {
170174
const context = useContext(AuthContext);
171175

0 commit comments

Comments
 (0)