[Flight] Compute better I/O description for exotic types (#34650)
Sebastian "Sebbie" Silbermann committed
Sep 29, 2025 at 21:03 UTC
ecb2ce6c5f34b2f8060d050817c030959d1cefe8
1 file changed
+8
-2
packages/shared/ReactIODescription.js
+8
-2
@@ -7,7 +7,7 @@
7
* @flow
8
*/
9
10
-export function getIODescription(value: any): string {
10
+export function getIODescription(value: mixed): string {
11
if (!__DEV__) {
12
return '';
13
}
@@ -34,11 +34,13 @@ export function getIODescription(value: any): string {
34
return value.command;
35
} else if (
36
typeof value.request === 'object' &&
37
+ value.request !== null &&
38
typeof value.request.url === 'string'
39
) {
40
return value.request.url;
41
} else if (
42
typeof value.response === 'object' &&
43
+ value.response !== null &&
44
typeof value.response.url === 'string'
45
) {
46
return value.response.url;
@@ -53,7 +55,11 @@ export function getIODescription(value: any): string {
55
return value.name;
56
} else {
57
const str = value.toString();
56
- if (str.startWith('[object ') || str.length < 5 || str.length > 500) {
58
+ if (
59
+ str.startsWith('[object ') ||
60
+ str.length < 5 ||
61
+ str.length > 500
62
+ ) {
63
// This is probably not a useful description.
64
return '';
65
}