From 9d47086222dc8936ec79d338d24703c802908166 Mon Sep 17 00:00:00 2001 From: Sebastian Sebbie Silbermann Date: Mon, 29 Sep 2025 20:32:20 +0200 Subject: [PATCH] [Flight] Fix crash when computing I/O description for exotic types --- packages/shared/ReactIODescription.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/shared/ReactIODescription.js b/packages/shared/ReactIODescription.js index 7fa6bb24393..e1a0fce2c4d 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 ''; }