auth-js
auth-js copied to clipboard
remove redundant `getSession` type
What kind of change does this PR introduce?
A fix for the getSession return type.
What is the current behavior?
It was difficult to use the following utility function:
async function withThrowOnError<T>(
promise: Promise<{ data: T; error: null } | { data: unknown; error: Error }>,
): Promise<T> {
const { data, error } = await promise;
if (error) throw error;
return data;
}
withThrowOnError(supabase.auth.getSession()); // Type `null` is not assignable to type `Session`.
What is the new behavior?
It conveniently fixes the type error without breaking anything.