7
7
* @param wat A value to be checked.
8
8
* @returns A boolean representing the result.
9
9
*/
10
- export function isError ( wat : any ) : boolean {
10
+ export function isError ( wat : any ) : wat is Error {
11
11
switch ( Object . prototype . toString . call ( wat ) ) {
12
12
case '[object Error]' :
13
13
return true ;
@@ -27,7 +27,7 @@ export function isError(wat: any): boolean {
27
27
* @param wat A value to be checked.
28
28
* @returns A boolean representing the result.
29
29
*/
30
- export function isErrorEvent ( wat : any ) : boolean {
30
+ export function isErrorEvent ( wat : any ) : wat is ErrorEvent {
31
31
return Object . prototype . toString . call ( wat ) === '[object ErrorEvent]' ;
32
32
}
33
33
@@ -38,7 +38,7 @@ export function isErrorEvent(wat: any): boolean {
38
38
* @param wat A value to be checked.
39
39
* @returns A boolean representing the result.
40
40
*/
41
- export function isDOMError ( wat : any ) : boolean {
41
+ export function isDOMError ( wat : any ) : wat is DOMError {
42
42
return Object . prototype . toString . call ( wat ) === '[object DOMError]' ;
43
43
}
44
44
@@ -49,7 +49,7 @@ export function isDOMError(wat: any): boolean {
49
49
* @param wat A value to be checked.
50
50
* @returns A boolean representing the result.
51
51
*/
52
- export function isDOMException ( wat : any ) : boolean {
52
+ export function isDOMException ( wat : any ) : wat is DOMException {
53
53
return Object . prototype . toString . call ( wat ) === '[object DOMException]' ;
54
54
}
55
55
@@ -60,7 +60,7 @@ export function isDOMException(wat: any): boolean {
60
60
* @param wat A value to be checked.
61
61
* @returns A boolean representing the result.
62
62
*/
63
- export function isString ( wat : any ) : boolean {
63
+ export function isString ( wat : any ) : wat is String {
64
64
return Object . prototype . toString . call ( wat ) === '[object String]' ;
65
65
}
66
66
@@ -117,7 +117,7 @@ export function isElement(wat: any): wat is Element {
117
117
* @param wat A value to be checked.
118
118
* @returns A boolean representing the result.
119
119
*/
120
- export function isRegExp ( wat : any ) : boolean {
120
+ export function isRegExp ( wat : any ) : wat is RegExp {
121
121
return Object . prototype . toString . call ( wat ) === '[object RegExp]' ;
122
122
}
123
123
0 commit comments