[Flight] Compute better I/O description for exotic types (#34650)

This commit is contained in:
Sebastian "Sebbie" Silbermann
2025-09-29 21:03:07 +02:00
committed by GitHub
parent 3580584ba2
commit ecb2ce6c5f

View File

@@ -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 '';
}