fix(nuxt): correct type for useError (#28996)

This commit is contained in:
Artem Maslov 2024-09-16 01:37:24 +05:00 committed by GitHub
parent 068d4ed677
commit 644b6fc1e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,13 +1,15 @@
import type { H3Error } from 'h3' import type { H3Error } from 'h3'
import { createError as createH3Error } from 'h3' import { createError as createH3Error } from 'h3'
import { toRef } from 'vue' import { toRef } from 'vue'
import type { Ref } from 'vue'
import { useNuxtApp } from '../nuxt' import { useNuxtApp } from '../nuxt'
import type { NuxtPayload } from '../nuxt'
import { useRouter } from './router' import { useRouter } from './router'
export const NUXT_ERROR_SIGNATURE = '__nuxt_error' export const NUXT_ERROR_SIGNATURE = '__nuxt_error'
/** @since 3.0.0 */ /** @since 3.0.0 */
export const useError = () => toRef(useNuxtApp().payload, 'error') export const useError = (): Ref<NuxtPayload['error']> => toRef(useNuxtApp().payload, 'error')
// eslint-disable-next-line @typescript-eslint/no-empty-object-type // eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface NuxtError<DataT = unknown> extends H3Error<DataT> {} export interface NuxtError<DataT = unknown> extends H3Error<DataT> {}