forked from tabrez96/cogo-toast
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
51 lines (43 loc) · 1.05 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { ReactNode, MouseEventHandler } from 'react';
export type CTOptions = Partial<{
hideAfter: number;
position:
| 'top-left'
| 'top-center'
| 'top-right'
| 'bottom-left'
| 'bottom-center'
| 'bottom-right';
heading: string;
role: string;
toastContainerID: string;
renderIcon: Function;
bar: Partial<{
size: string;
style: 'solid' | 'dashed' | 'dotted';
color: string;
}>;
onClick: MouseEventHandler;
}>;
export type HideToastFunction = () => void;
export type CTReturn = Promise<void> & { hide?: HideToastFunction };
export type CTMethod = (message: string | ReactNode, options?: CTOptions) => CTReturn;
export type CTMainMethod = (
message: string | ReactNode,
options?: CTOptions & { type: string },
) => CTReturn;
export type CToast = CTMainMethod & {
success: CTMethod;
warn: CTMethod;
info: CTMethod;
error: CTMethod;
loading: CTMethod;
};
declare namespace cogoToast {
const success: CTMethod;
const info: CTMethod;
const loading: CTMethod;
const warn: CTMethod;
const error: CTMethod;
}
export default cogoToast;