Fix TypeScript errors
Addresses TypeScript errors related to toast implementation and type definitions.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
|
||||
import * as React from "react"
|
||||
import { ToastProps } from "@/components/ui/toast"
|
||||
|
||||
@@ -68,22 +69,17 @@ export const useToast = () => {
|
||||
addToast,
|
||||
updateToast,
|
||||
dismissToast,
|
||||
toast: (props: ToasterToast) => addToast(props), // toast 속성 추가
|
||||
};
|
||||
};
|
||||
|
||||
// 전역 토스트 함수에도 기본 지속 시간 적용
|
||||
export const toast = ({
|
||||
...props
|
||||
}: ToastActionElement & {
|
||||
title?: React.ReactNode;
|
||||
description?: React.ReactNode;
|
||||
duration?: number;
|
||||
}) => {
|
||||
export const toast = (props: Omit<ToasterToast, "id">) => {
|
||||
// 기본 지속 시간을 적용
|
||||
const toastWithDefaults = {
|
||||
...props,
|
||||
duration: props.duration || DEFAULT_TOAST_DURATION,
|
||||
};
|
||||
|
||||
return toastStore.getState().addToast(toastWithDefaults);
|
||||
return useToastStore().addToast(toastWithDefaults);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user