Fix TypeScript errors
Addresses TypeScript errors related to toast implementation and type definitions.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user