Hello, how can I fix typesript error here ?
"TS2339: Property length does not exist on type never"
import { appendResponseHeader, H3Event } from 'h3'
export default defineNuxtPlugin(async (nuxtApp) => {
const auth = useAuthStore()
var setCookies: string[] | null = null
if (!auth.csrfToken) {
await useFetch('http://localhost:8000/sanctum/csrf-cookie', {
headers: {
Accept: 'application/json',
},
credentials: 'include',
onResponse: (response) => {
setCookies = response.response.headers.getSetCookie() as string[]
},
})
// here the ts error
if (setCookies && setCookies.length > 0) {
for (let index in setCookies) {
appendResponseHeader(
useRequestEvent(),
'set-cookie',
setCookies[index]
)
}
}
}
})