Skip to content

🎥 Make videos programmatically with React

fix one line update

Jonny Burgerffbdc00a8531
diff --git a/packages/cli/src/codemods/update-default-props.ts b/packages/cli/src/codemods/update-default-props.ts
index 575d86008d..cf632d291d 100644
--- a/packages/cli/src/codemods/update-default-props.ts
+++ b/packages/cli/src/codemods/update-default-props.ts
@@ -48,6 +48,12 @@ const findEndPosition = (input: string, currentPosition: number) => {
return nextEnd - 1;
}
+ // When updating e.g. `defaultProps={{union: {type: 'car' as const, color: ''}}}`
+ const nextTriple = input.indexOf('}}}', currentPosition + 1);
+ if (nextTriple !== -1) {
+ return nextTriple + 1;
+ }
+
const next = input.indexOf('}}', currentPosition + 1);
if (next !== -1) {
return next;