fix(types): add explicit return type for useToast to resolve ts(2742) error
This commit is contained in:
parent
e0d4980e31
commit
67a5938113
|
|
@ -1,4 +1,4 @@
|
|||
import type { Component, VNode } from 'vue'
|
||||
import type { Component, ComputedRef, VNode } from 'vue'
|
||||
import type { ToastProps } from '.'
|
||||
import { computed, ref } from 'vue'
|
||||
|
||||
|
|
@ -121,6 +121,16 @@ function dispatch(action: Action) {
|
|||
}
|
||||
}
|
||||
|
||||
interface UseToast {
|
||||
dismiss: (toastId?: string) => void
|
||||
toast: (props: Toast) => {
|
||||
dismiss: () => void
|
||||
id: string
|
||||
update: (props: ToasterToast) => void
|
||||
}
|
||||
toasts: ComputedRef<ToasterToast[]>
|
||||
}
|
||||
|
||||
function useToast() {
|
||||
return {
|
||||
toasts: computed(() => state.value.toasts),
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { Component, VNode } from 'vue'
|
||||
import type { Component, ComputedRef, VNode } from 'vue'
|
||||
import type { ToastProps } from '.'
|
||||
import { computed, ref } from 'vue'
|
||||
|
||||
|
|
@ -121,6 +121,17 @@ function dispatch(action: Action) {
|
|||
}
|
||||
}
|
||||
|
||||
interface UseToast {
|
||||
dismiss: (toastId?: string) => void
|
||||
toast: (props: Toast) => {
|
||||
dismiss: () => void
|
||||
id: string
|
||||
update: (props: ToasterToast) => void
|
||||
}
|
||||
toasts: ComputedRef<ToasterToast[]>
|
||||
}
|
||||
|
||||
|
||||
function useToast() {
|
||||
return {
|
||||
toasts: computed(() => state.value.toasts),
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user