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

This commit is contained in:
Julien Huang 2024-09-11 00:08:37 +02:00 committed by GitHub
parent 9edba0d7ea
commit 32a66364cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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