mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-14 01:53:55 +00:00
fix(nuxt): correct type for useError
(#28996)
This commit is contained in:
parent
98215d7956
commit
870e4f6b4a
@ -1,7 +1,9 @@
|
|||||||
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'
|
||||||
|
|
||||||
// @ts-expect-error virtual file
|
// @ts-expect-error virtual file
|
||||||
@ -10,7 +12,7 @@ import { nuxtDefaultErrorValue } from '#build/nuxt.config.mjs'
|
|||||||
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> {}
|
||||||
|
Loading…
Reference in New Issue
Block a user