Skip to content

Commit

Permalink
useCurrentUser type fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobbe committed Mar 3, 2023
1 parent 1ce5d60 commit b5180cc
Show file tree
Hide file tree
Showing 19 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ beforeEach(() => {
})

function getAuth0Auth(customProviderHooks?: {
useCurrentUser?: () => Promise<Record<string, unknown>>
useCurrentUser?: () => Promise<CurrentUser>
useHasRole?: (
currentUser: CurrentUser | null
) => (rolesToCheck: string | string[]) => boolean
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/auth0/web/src/auth0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface Auth0User {}
export function createAuth(
auth0Client: Auth0Client,
customProviderHooks?: {
useCurrentUser?: () => Promise<Record<string, unknown>>
useCurrentUser?: () => Promise<CurrentUser>
useHasRole?: (
currentUser: CurrentUser | null
) => (rolesToCheck: string | string[]) => boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ beforeEach(() => {
})

function getAzureActiveDirectoryAuth(customProviderHooks?: {
useCurrentUser?: () => Promise<Record<string, unknown>>
useCurrentUser?: () => Promise<CurrentUser>
useHasRole?: (
currentUser: CurrentUser | null
) => (rolesToCheck: string | string[]) => boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { CurrentUser, createAuthentication } from '@redwoodjs/auth'
export function createAuth(
azureActiveDirectoryClient: AzureActiveDirectoryClient,
customProviderHooks?: {
useCurrentUser?: () => Promise<Record<string, unknown>>
useCurrentUser?: () => Promise<CurrentUser>
useHasRole?: (
currentUser: CurrentUser | null
) => (rolesToCheck: string | string[]) => boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ beforeEach(() => {
})

function getClerkAuth(customProviderHooks?: {
useCurrentUser?: () => Promise<Record<string, unknown>>
useCurrentUser?: () => Promise<CurrentUser>
useHasRole?: (
currentUser: CurrentUser | null
) => (rolesToCheck: string | string[]) => boolean
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/clerk/web/src/clerk.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { CurrentUser, createAuthentication } from '@redwoodjs/auth'
type Clerk = ClerkClient | undefined | null

export function createAuth(customProviderHooks?: {
useCurrentUser?: () => Promise<Record<string, unknown>>
useCurrentUser?: () => Promise<CurrentUser>
useHasRole?: (
currentUser: CurrentUser | null
) => (rolesToCheck: string | string[]) => boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ beforeEach(() => {
})

const defaultArgs: DbAuthClientArgs & {
useCurrentUser?: () => Promise<Record<string, unknown>>
useCurrentUser?: () => Promise<CurrentUser>
useHasRole?: (
currentUser: CurrentUser | null
) => (rolesToCheck: string | string[]) => boolean
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/dbAuth/web/src/dbAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const TOKEN_CACHE_TIME = 5000
export function createAuth(
dbAuthClient: ReturnType<typeof createDbAuthClient>,
customProviderHooks?: {
useCurrentUser?: () => Promise<Record<string, unknown>>
useCurrentUser?: () => Promise<CurrentUser>
useHasRole?: (
currentUser: CurrentUser | null
) => (rolesToCheck: string | string[]) => boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ beforeEach(() => {
})

function getFirebaseAuth(customProviderHooks?: {
useCurrentUser?: () => Promise<Record<string, unknown>>
useCurrentUser?: () => Promise<CurrentUser>
useHasRole?: (
currentUser: CurrentUser | null
) => (rolesToCheck: string | string[]) => boolean
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/firebase/web/src/firebase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const applyProviderOptions = (
export function createAuth(
firebaseClient: FirebaseClient,
customProviderHooks?: {
useCurrentUser?: () => Promise<Record<string, unknown>>
useCurrentUser?: () => Promise<CurrentUser>
useHasRole?: (
currentUser: CurrentUser | null
) => (rolesToCheck: string | string[]) => boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ beforeEach(() => {
})

function getNetlifyAuth(customProviderHooks?: {
useCurrentUser?: () => Promise<Record<string, unknown>>
useCurrentUser?: () => Promise<CurrentUser>
useHasRole?: (
currentUser: CurrentUser | null
) => (rolesToCheck: string | string[]) => boolean
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/netlify/web/src/netlify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type NetlifyIdentity = typeof NetlifyIdentityNS
export function createAuth(
netlifyIdentity: NetlifyIdentity,
customProviderHooks?: {
useCurrentUser?: () => Promise<Record<string, unknown>>
useCurrentUser?: () => Promise<CurrentUser>
useHasRole?: (
currentUser: CurrentUser | null
) => (rolesToCheck: string | string[]) => boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ beforeEach(() => {
})

function getSupabaseAuth(customProviderHooks?: {
useCurrentUser?: () => Promise<Record<string, unknown>>
useCurrentUser?: () => Promise<CurrentUser>
useHasRole?: (
currentUser: CurrentUser | null
) => (rolesToCheck: string | string[]) => boolean
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/supabase/web/src/supabase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type SignUpOptions = {
export function createAuth(
supabaseClient: SupabaseClient,
customProviderHooks?: {
useCurrentUser?: () => Promise<Record<string, unknown>>
useCurrentUser?: () => Promise<CurrentUser>
useHasRole?: (
currentUser: CurrentUser | null
) => (rolesToCheck: string | string[]) => boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ beforeEach(() => {
})

function getSuperTokensAuth(customProviderHooks?: {
useCurrentUser?: () => Promise<Record<string, unknown>>
useCurrentUser?: () => Promise<CurrentUser>
useHasRole?: (
currentUser: CurrentUser | null
) => (rolesToCheck: string | string[]) => boolean
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/supertokens/web/src/supertokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export type SessionRecipe = {
export function createAuth(
superTokens: SuperTokensAuth,
customProviderHooks?: {
useCurrentUser?: () => Promise<Record<string, unknown>>
useCurrentUser?: () => Promise<CurrentUser>
useHasRole?: (
currentUser: CurrentUser | null
) => (rolesToCheck: string | string[]) => boolean
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/AuthProvider/AuthProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export function createAuthProvider<
TClient
>,
customProviderHooks?: {
useCurrentUser?: () => Promise<Record<string, unknown>>
useCurrentUser?: () => Promise<CurrentUser>
useHasRole?: (
currentUser: CurrentUser | null
) => (rolesToCheck: string | string[]) => boolean
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/__tests__/fixtures/customTestAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface CustomTestAuthClient {
export function createCustomTestAuth(
customTest: CustomTestAuthClient,
customProviderHooks?: {
useCurrentUser?: () => Promise<Record<string, unknown>>
useCurrentUser?: () => Promise<CurrentUser>
useHasRole?: (
currentUser: CurrentUser | null
) => (rolesToCheck: string | string[]) => boolean
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/authFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function createAuthentication<
TClient
>,
customProviderHooks?: {
useCurrentUser?: () => Promise<Record<string, unknown>>
useCurrentUser?: () => Promise<CurrentUser>
useHasRole?: (
currentUser: CurrentUser | null
) => (rolesToCheck: string | string[]) => boolean
Expand Down

0 comments on commit b5180cc

Please sign in to comment.