🎥 Make videos programmatically with React
make all strings "as const"
Jonny Burger8c1492f46799
diff --git a/packages/cli/src/codemods/update-default-props.ts b/packages/cli/src/codemods/update-default-props.tsindex 1eb5aedfa1..bc256480b1 100644--- a/packages/cli/src/codemods/update-default-props.ts+++ b/packages/cli/src/codemods/update-default-props.ts@@ -94,10 +94,15 @@ const stringifyDefaultProps = (props: unknown) => {).toISOString()}')__REMOVEQUOTE__`;}+ if (typeof this[key] === 'string') {+ return `${this[key]}__ADD_AS_CONST__`;+ }+return value;})- .replace('"__REMOVEQUOTE__', '')- .replace('__REMOVEQUOTE__"', '');+ .replace(/"__REMOVEQUOTE__/g, '')+ .replace(/__REMOVEQUOTE__"/g, '')+ .replace(/__ADD_AS_CONST__"/g, '" as const');};// TODO: Add more sanity checksdiff --git a/packages/example/src/Video.tsx b/packages/example/src/Video.tsxindex db9b3a43c3..255c72522f 100644--- a/packages/example/src/Video.tsx+++ b/packages/example/src/Video.tsx@@ -708,23 +708,27 @@ export const Index: React.FC = () => {supersuperlongvalueabcdefghji: z.string(),})}defaultProps={{- vehicle: 'bus',- other: 'hi',- abc: {def: {xyz: 'huthere', pef: 'hu'}, jkl: 'sting', xyz: 'hi'},+ vehicle: 'caa' as const,+ other: 'hi' as const,+ abc: {+ def: {xyz: 'huthere' as const, pef: 'hu' as const},+ jkl: 'sting' as const,+ xyz: 'hi' as const,+ },array: [- {a: 'a', b: 'bbbbb'},- {a: 'a', b: 'b'},+ {a: 'a' as const, b: 'bbbbb' as const},+ {a: 'a' as const, b: 'b' as const},],array2: [[12], [12]],mynum: 4,value: true,haha: null,- yo: {hi: ' there'},- un: 'hi',- num: '179',+ yo: {hi: ' there' as const},+ un: 'hi' as const,+ num: '179' as const,date: new Date('1999-02-12T20:20:00.000Z'),- values: 'a',- supersuperlongvalueabcdefghji: 'hi',+ values: 'a' as const,+ supersuperlongvalueabcdefghji: 'hi' as const,}}durationInFrames={150}/>