2
2
// Definitions by: akki-jat <https://github.com/akki-jat>
3
3
// Definitions: https://github.com/vueComponent/ant-design-vue/types
4
4
5
+ import { VNode , CreateElement } from 'vue'
6
+
7
+ export interface ThenableArgument {
8
+ ( val : any ) : void ;
9
+ }
10
+ export interface MessageType {
11
+ ( ) : void ;
12
+ then : ( fill : ThenableArgument , reject : ThenableArgument ) => Promise < void > ;
13
+ promise : Promise < void > ;
14
+ }
15
+ export type ConfigType = string | VNode | ( ( h : CreateElement ) => VNode ) ;
16
+ export type ConfigDuration = number | ( ( ) => void ) ;
17
+ export type ConfigOnClose = ( ) => void ;
18
+
5
19
export interface MessageOptions {
6
20
/**
7
21
* content of the message
8
22
* @type any (string | VNode | (h) => VNode)
9
23
*/
10
- content : any ;
24
+ content : ConfigType ;
11
25
12
26
/**
13
27
* time(seconds) before auto-dismiss, don't dismiss if set to 0
@@ -26,13 +40,13 @@ export interface MessageOptions {
26
40
* Customized Icon
27
41
* @type any (string | VNode | (h) => VNode)
28
42
*/
29
- icon ?: any ;
43
+ icon ?: ConfigType ;
30
44
31
45
/**
32
46
* Specify a function that will be called when the message is closed
33
47
* @type Function
34
48
*/
35
- onClose ?: ( ) => void ;
49
+ onClose ?: ConfigOnClose ;
36
50
key ?: string | number ;
37
51
}
38
52
@@ -65,14 +79,20 @@ export interface MessageConfigOptions {
65
79
top ?: string ;
66
80
}
67
81
68
- export declare class Message {
69
- success ( content : any , duration ?: number , onClose ?: ( ) => void ) : Promise < any > ;
70
- warning ( content : any , duration ?: number , onClose ?: ( ) => void ) : Promise < any > ;
71
- warn ( content : any , duration ?: number , onClose ?: ( ) => void ) : Promise < any > ;
72
- info ( content : any , duration ?: number , onClose ?: ( ) => void ) : Promise < any > ;
73
- error ( content : any , duration ?: number , onClose ?: ( ) => void ) : Promise < any > ;
74
- loading ( content : any , duration ?: number , onClose ?: ( ) => void ) : Promise < any > ;
75
- open : ( config : MessageOptions ) => Promise < any > ;
82
+ export declare interface Message {
83
+ success ( content : MessageOptions ) : MessageType ;
84
+ success ( content : ConfigType , duration ?: ConfigDuration , onClose ?: ConfigOnClose ) : MessageType ;
85
+ warning ( content : MessageOptions ) : MessageType ;
86
+ warning ( content : ConfigType , duration ?: ConfigDuration , onClose ?: ConfigOnClose ) : MessageType ;
87
+ warn ( content : MessageOptions ) : MessageType ;
88
+ warn ( content : ConfigType , duration ?: ConfigDuration , onClose ?: ConfigOnClose ) : MessageType ;
89
+ info ( content : MessageOptions ) : MessageType ;
90
+ info ( content : ConfigType , duration ?: ConfigDuration , onClose ?: ConfigOnClose ) : MessageType ;
91
+ error ( content : MessageOptions ) : MessageType ;
92
+ error ( content : ConfigType , duration ?: ConfigDuration , onClose ?: ConfigOnClose ) : MessageType ;
93
+ loading ( content : MessageOptions ) : MessageType ;
94
+ loading ( content : ConfigType , duration ?: ConfigDuration , onClose ?: ConfigOnClose ) : MessageType ;
95
+ open : ( config : MessageOptions ) => MessageType ;
76
96
config : ( options : MessageConfigOptions ) => void ;
77
97
destroy : ( ) => void ;
78
98
}
0 commit comments