🎥 Make videos programmatically with React
Fix type error: move oldValueString extraction after attr type guard
Jonny Burger86f931899c61
diff --git a/packages/studio-server/src/codemods/update-sequence-props.ts b/packages/studio-server/src/codemods/update-sequence-props.tsindex ff3a01c0c1..1e445db913 100644--- a/packages/studio-server/src/codemods/update-sequence-props.ts+++ b/packages/studio-server/src/codemods/update-sequence-props.ts@@ -61,15 +61,6 @@ export const updateSequenceProps = async ({return this.traverse(path);}- if (attr.value) {- const printed = recast.print(attr.value).code;- // Strip JSX expression container braces, e.g. "{30}" -> "30"- oldValueString =- printed.startsWith('{') && printed.endsWith('}')- ? printed.slice(1, -1)- : printed;- }-const parsed = ((parseAst(`a = ${stringifyDefaultProps({props: value, enumPaths})}`)@@ -89,6 +80,15 @@ export const updateSequenceProps = async ({node.attributes.push(newAttr);} else {+ if (attr.value) {+ const printed = recast.print(attr.value).code;+ // Strip JSX expression container braces, e.g. "{30}" -> "30"+ oldValueString =+ printed.startsWith('{') && printed.endsWith('}')+ ? printed.slice(1, -1)+ : printed;+ }+attr.value = recast.types.builders.jsxExpressionContainer(parsed);}