fix(nuxt): make runWithContext generic (#28926)

This commit is contained in:
Julien Huang 2024-09-11 00:08:37 +02:00 committed by Daniel Roe
parent 5a61bc52f2
commit 275481c456
No known key found for this signature in database
GPG Key ID: 3714AB03996F442B

View File

@ -275,7 +275,7 @@ export function createNuxtApp (options: CreateOptions) {
static: { static: {
data: {}, data: {},
}, },
runWithContext (fn: any) { runWithContext <T>(fn: () => T) {
if (nuxtApp._scope.active && !getCurrentScope()) { if (nuxtApp._scope.active && !getCurrentScope()) {
return nuxtApp._scope.run(() => callWithNuxt(nuxtApp, fn)) return nuxtApp._scope.run(() => callWithNuxt(nuxtApp, fn))
} }