@@ -9,7 +9,7 @@ import { Primitive } from '@sentry/types';
9
9
* @param wat A value to be checked.
10
10
* @returns A boolean representing the result.
11
11
*/
12
- export function isError ( wat : any ) : boolean {
12
+ export function isError ( wat : unknown ) : boolean {
13
13
switch ( Object . prototype . toString . call ( wat ) ) {
14
14
case '[object Error]' :
15
15
return true ;
@@ -29,7 +29,7 @@ export function isError(wat: any): boolean {
29
29
* @param wat A value to be checked.
30
30
* @returns A boolean representing the result.
31
31
*/
32
- export function isErrorEvent ( wat : any ) : boolean {
32
+ export function isErrorEvent ( wat : unknown ) : boolean {
33
33
return Object . prototype . toString . call ( wat ) === '[object ErrorEvent]' ;
34
34
}
35
35
@@ -40,7 +40,7 @@ export function isErrorEvent(wat: any): boolean {
40
40
* @param wat A value to be checked.
41
41
* @returns A boolean representing the result.
42
42
*/
43
- export function isDOMError ( wat : any ) : boolean {
43
+ export function isDOMError ( wat : unknown ) : boolean {
44
44
return Object . prototype . toString . call ( wat ) === '[object DOMError]' ;
45
45
}
46
46
@@ -51,7 +51,7 @@ export function isDOMError(wat: any): boolean {
51
51
* @param wat A value to be checked.
52
52
* @returns A boolean representing the result.
53
53
*/
54
- export function isDOMException ( wat : any ) : boolean {
54
+ export function isDOMException ( wat : unknown ) : boolean {
55
55
return Object . prototype . toString . call ( wat ) === '[object DOMException]' ;
56
56
}
57
57
@@ -62,7 +62,7 @@ export function isDOMException(wat: any): boolean {
62
62
* @param wat A value to be checked.
63
63
* @returns A boolean representing the result.
64
64
*/
65
- export function isString ( wat : any ) : boolean {
65
+ export function isString ( wat : unknown ) : boolean {
66
66
return Object . prototype . toString . call ( wat ) === '[object String]' ;
67
67
}
68
68
@@ -73,7 +73,7 @@ export function isString(wat: any): boolean {
73
73
* @param wat A value to be checked.
74
74
* @returns A boolean representing the result.
75
75
*/
76
- export function isPrimitive ( wat : any ) : wat is Primitive {
76
+ export function isPrimitive ( wat : unknown ) : wat is Primitive {
77
77
return wat === null || ( typeof wat !== 'object' && typeof wat !== 'function' ) ;
78
78
}
79
79
@@ -84,7 +84,7 @@ export function isPrimitive(wat: any): wat is Primitive {
84
84
* @param wat A value to be checked.
85
85
* @returns A boolean representing the result.
86
86
*/
87
- export function isPlainObject ( wat : any ) : boolean {
87
+ export function isPlainObject ( wat : unknown ) : wat is Record < string , unknown > {
88
88
return Object . prototype . toString . call ( wat ) === '[object Object]' ;
89
89
}
90
90
@@ -95,7 +95,7 @@ export function isPlainObject(wat: any): boolean {
95
95
* @param wat A value to be checked.
96
96
* @returns A boolean representing the result.
97
97
*/
98
- export function isEvent ( wat : any ) : boolean {
98
+ export function isEvent ( wat : unknown ) : wat is Event {
99
99
return typeof Event !== 'undefined' && isInstanceOf ( wat , Event ) ;
100
100
}
101
101
@@ -106,7 +106,7 @@ export function isEvent(wat: any): boolean {
106
106
* @param wat A value to be checked.
107
107
* @returns A boolean representing the result.
108
108
*/
109
- export function isElement ( wat : any ) : boolean {
109
+ export function isElement ( wat : unknown ) : wat is Element {
110
110
return typeof Element !== 'undefined' && isInstanceOf ( wat , Element ) ;
111
111
}
112
112
@@ -117,15 +117,15 @@ export function isElement(wat: any): boolean {
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 : unknown ) : wat is RegExp {
121
121
return Object . prototype . toString . call ( wat ) === '[object RegExp]' ;
122
122
}
123
123
124
124
/**
125
125
* Checks whether given value has a then function.
126
126
* @param wat A value to be checked.
127
127
*/
128
- export function isThenable ( wat : any ) : boolean {
128
+ export function isThenable ( wat : any ) : wat is PromiseLike < any > {
129
129
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
130
130
return Boolean ( wat && wat . then && typeof wat . then === 'function' ) ;
131
131
}
@@ -137,7 +137,7 @@ export function isThenable(wat: any): boolean {
137
137
* @param wat A value to be checked.
138
138
* @returns A boolean representing the result.
139
139
*/
140
- export function isSyntheticEvent ( wat : any ) : boolean {
140
+ export function isSyntheticEvent ( wat : unknown ) : boolean {
141
141
return isPlainObject ( wat ) && 'nativeEvent' in wat && 'preventDefault' in wat && 'stopPropagation' in wat ;
142
142
}
143
143
/**
0 commit comments