From d6f58492a9f21843929e8ef204d8388eae65d7cd Mon Sep 17 00:00:00 2001 From: Carlos Cortizas <97907068+CarlosCortizasCT@users.noreply.github.com> Date: Mon, 23 Dec 2024 11:57:38 +0100 Subject: [PATCH] refactor(codemod): improve js components migration (#3682) --- .../codemod/src/transforms/react-default-props-migration.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/codemod/src/transforms/react-default-props-migration.ts b/packages/codemod/src/transforms/react-default-props-migration.ts index cac3c625a7..a16b06a26a 100644 --- a/packages/codemod/src/transforms/react-default-props-migration.ts +++ b/packages/codemod/src/transforms/react-default-props-migration.ts @@ -309,7 +309,10 @@ function extractDefaultPropsFromNode( defaultPropsNode: ObjectExpression ): TDefaultPropsMap { return defaultPropsNode.properties.reduce((acc, prop) => { - if (prop.type === 'ObjectProperty' && prop.key.type === 'Identifier') { + if ( + (prop.type === 'ObjectProperty' || prop.type === 'Property') && + prop.key.type === 'Identifier' + ) { return { ...acc, [prop.key.name as string]: