Skip to content

Commit ecb2ce6

Browse files
authored
[Flight] Compute better I/O description for exotic types (facebook#34650)
1 parent 3580584 commit ecb2ce6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

packages/shared/ReactIODescription.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @flow
88
*/
99

10-
export function getIODescription(value: any): string {
10+
export function getIODescription(value: mixed): string {
1111
if (!__DEV__) {
1212
return '';
1313
}
@@ -34,11 +34,13 @@ export function getIODescription(value: any): string {
3434
return value.command;
3535
} else if (
3636
typeof value.request === 'object' &&
37+
value.request !== null &&
3738
typeof value.request.url === 'string'
3839
) {
3940
return value.request.url;
4041
} else if (
4142
typeof value.response === 'object' &&
43+
value.response !== null &&
4244
typeof value.response.url === 'string'
4345
) {
4446
return value.response.url;
@@ -53,7 +55,11 @@ export function getIODescription(value: any): string {
5355
return value.name;
5456
} else {
5557
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+
) {
5763
// This is probably not a useful description.
5864
return '';
5965
}

0 commit comments

Comments
 (0)