diff --git a/packages/shared/ReactIODescription.js b/packages/shared/ReactIODescription.js index 7fa6bb243936f..e1a0fce2c4d0a 100644 --- a/packages/shared/ReactIODescription.js +++ b/packages/shared/ReactIODescription.js @@ -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 ''; }