Skip to content

Commit 09bff84

Browse files
authored
fix(types): add explicit type annotations for plugins (#408)
1 parent 98ca959 commit 09bff84

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/runtime/plugins/auth-redirect.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { Plugin } from '#app'
12
import type { Ref } from '#imports'
23
import { defineNuxtPlugin, addRouteMiddleware, defineNuxtRouteMiddleware, useCookie, useRuntimeConfig, navigateTo, useSupabaseSession } from '#imports'
34
import type { RouteLocationNormalized } from '#vue-router'
@@ -24,7 +25,7 @@ export default defineNuxtPlugin({
2425
}
2526

2627
// Do not redirect on login route, callback route and excluded routes
27-
const isExcluded = [...exclude, login, callback]?.some((path) => {
28+
const isExcluded = [...exclude ?? [], login, callback]?.some((path) => {
2829
const regex = new RegExp(`^${path.replace(/\*/g, '.*')}$`)
2930
return regex.test(to.path)
3031
})
@@ -42,4 +43,4 @@ export default defineNuxtPlugin({
4243
{ global: true },
4344
)
4445
},
45-
})
46+
}) as Plugin

src/runtime/plugins/supabase.client.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { createBrowserClient } from '@supabase/ssr'
2-
import type { Session } from '@supabase/supabase-js'
2+
import type { Session, SupabaseClient } from '@supabase/supabase-js'
33
import { fetchWithRetry } from '../utils/fetch-retry'
4+
import type { Plugin } from '#app'
45
import { defineNuxtPlugin, useRuntimeConfig, useSupabaseSession, useSupabaseUser } from '#imports'
56

67
export default defineNuxtPlugin({
@@ -43,4 +44,4 @@ export default defineNuxtPlugin({
4344
},
4445
}
4546
},
46-
})
47+
}) as Plugin<{ client: SupabaseClient }>

0 commit comments

Comments
 (0)