← Back to Help Center

Remove TypeScript-only syntax from preview code

Fix preview parse failures caused by TypeScript annotations in JSX-only execution contexts.

typescriptjsxbabel

Symptoms

  • Preview parser rejects valid-looking code with token errors around colons.
  • Errors start after pasting TS snippets from external projects.

Root cause

Section preview expects plain JavaScript/JSX, but code includes TypeScript annotations or declarations.

Fix steps

  1. 1. Remove parameter and variable type annotations (e.g., `: string`).
  2. 2. Delete interface/type blocks from section code.
  3. 3. Replace TS casts (`as Type`) with plain JS expressions.

Prevent it next time

  • Keep section code plain JSX when editing inside the builder.