Skip to content

Commit

Permalink
fix(mixins): ensure we do not lose type of withAuthFinder
Browse files Browse the repository at this point in the history
  • Loading branch information
RomainLanz committed Mar 13, 2024
1 parent 19d7042 commit 96663d3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export { AuthManager } from './src/auth_manager.js'
export { defineConfig } from './src/define_config.js'
export { Authenticator } from './src/authenticator.js'
export { AuthenticatorClient } from './src/authenticator_client.js'
import type { withAuthFinder as withAuthFinderType } from './src/mixins/with_auth_finder.js'

function isModuleInstalled(moduleName: string) {
try {
Expand All @@ -25,10 +26,11 @@ function isModuleInstalled(moduleName: string) {
}

// @deprecate Import `withAuthFinder` from `@adonisjs/auth/mixins` instead
let withAuthFinder
let withAuthFinder: typeof withAuthFinderType

if (isModuleInstalled('@adonisjs/lucid')) {
withAuthFinder = await import('./src/mixins/with_auth_finder.js')
const { withAuthFinder: withAuthFinderFn } = await import('./src/mixins/with_auth_finder.js')
withAuthFinder = withAuthFinderFn
}

export { withAuthFinder }

0 comments on commit 96663d3

Please sign in to comment.