Skip to content

🎥 Make videos programmatically with React

fix crash

Jonny Burgerbd072ac18203
diff --git a/packages/cli/src/codemods/update-default-props.ts b/packages/cli/src/codemods/update-default-props.ts
index e89ef1ba6f..fc2340d9d9 100644
--- a/packages/cli/src/codemods/update-default-props.ts
+++ b/packages/cli/src/codemods/update-default-props.ts
@@ -37,11 +37,6 @@ const findStarter = ({
};
const findEndPosition = (input: string, currentPosition: number) => {
- const next = input.indexOf('}}', currentPosition + 1);
- if (next !== -1) {
- return next;
- }
-
const asConstVersion = input
.slice(currentPosition + 1)
.search(/as\sconst[ \t\n\r]+\}/);
@@ -50,6 +45,11 @@ const findEndPosition = (input: string, currentPosition: number) => {
return nextEnd - 1;
}
+ const next = input.indexOf('}}', currentPosition + 1);
+ if (next !== -1) {
+ return next;
+ }
+
throw new Error('Could not find end of defaultProps');
};