mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
[Flight] Compute better I/O description for exotic types (#34650)
This commit is contained in:
committed by
GitHub
parent
3580584ba2
commit
ecb2ce6c5f
@@ -7,7 +7,7 @@
|
||||
* @flow
|
||||
*/
|
||||
|
||||
export function getIODescription(value: any): string {
|
||||
export function getIODescription(value: mixed): string {
|
||||
if (!__DEV__) {
|
||||
return '';
|
||||
}
|
||||
@@ -34,11 +34,13 @@ export function getIODescription(value: any): string {
|
||||
return value.command;
|
||||
} else if (
|
||||
typeof value.request === 'object' &&
|
||||
value.request !== null &&
|
||||
typeof value.request.url === 'string'
|
||||
) {
|
||||
return value.request.url;
|
||||
} else if (
|
||||
typeof value.response === 'object' &&
|
||||
value.response !== null &&
|
||||
typeof value.response.url === 'string'
|
||||
) {
|
||||
return value.response.url;
|
||||
@@ -53,7 +55,11 @@ export function getIODescription(value: any): string {
|
||||
return value.name;
|
||||
} else {
|
||||
const str = value.toString();
|
||||
if (str.startWith('[object ') || str.length < 5 || str.length > 500) {
|
||||
if (
|
||||
str.startsWith('[object ') ||
|
||||
str.length < 5 ||
|
||||
str.length > 500
|
||||
) {
|
||||
// This is probably not a useful description.
|
||||
return '';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user