Fix TypeScript errors

Addresses TypeScript errors related to toast implementation and type definitions.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-16 09:15:27 +00:00
parent 7ab79d125e
commit 7b50054da4
6 changed files with 23 additions and 17 deletions

View File

@@ -1,5 +1,5 @@
import { useToast as useOriginalToast, toast as originalToast } from '@/hooks/use-toast';
import { useToast as useOriginalToast, toast as originalToast, ToasterToast } from '@/hooks/use-toast';
// 토스트 중복 호출 방지를 위한 디바운스 구현
let lastToastTime = 0;
@@ -7,7 +7,7 @@ let lastToastMessage = '';
const DEBOUNCE_TIME = 500; // 0.5초 내에 동일 메시지 방지
// 중복 토스트 방지 래퍼 함수
const debouncedToast = (params: Parameters<typeof originalToast>[0]) => {
const debouncedToast = (params: Omit<ToasterToast, "id">) => {
const now = Date.now();
const currentMessage = params.description?.toString() || '';
@@ -26,5 +26,12 @@ const debouncedToast = (params: Parameters<typeof originalToast>[0]) => {
});
};
export const useToast = useOriginalToast;
export const toast = debouncedToast as typeof originalToast;
export const useToast = () => {
const toast = useOriginalToast();
return {
...toast,
toast: debouncedToast,
};
};
export const toast = debouncedToast;