Skip to content

fix(codegen): preserve string values in generated JSX - #383

Draft
KennyMcSimpson wants to merge 1 commit into
vercel-labs:mainfrom
KennyMcSimpson:fix/codegen-jsx-string-values
Draft

KennyMcSimpson wants to merge 1 commit into
vercel-labs:mainfrom
KennyMcSimpson:fix/codegen-jsx-string-values

Conversation

@KennyMcSimpson

Copy link
Copy Markdown

Closes #379.

String props are escaped as JavaScript strings, but serializeProps() currently places them in quoted JSX attributes. A value such as Quoted "temperature" then produces invalid TSX. Backslashes and newlines can also compile to a different value.

Emit string props as JSX expressions, so the existing JavaScript escaping is interpreted correctly: title={"Quoted \"temperature\""}.

The tests compile the generated TSX and evaluate its props for both quote modes. They cover quotes, apostrophes, line breaks, tabs, backslashes, entities, and empty strings. Boolean shorthand and nullish prop handling are covered as well. The package docs, web reference, skill examples, and codegen page's documentation parity hashes are updated to match the output.

Testing

  • pnpm exec vitest run packages/codegen/src/serialize.test.ts packages/codegen/src/traverse.test.ts — 13 tests passed.
  • pnpm type-check — passed across all 60 tasks.
  • pnpm --filter @json-render/codegen typecheck — passed.
  • Prettier check passed for the changed TypeScript files and documentation fixture.
  • Documentation hashes were checked with the existing Markdown converter.

@vercel

vercel Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

@KennyMcSimpson is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(codegen): quoted string props produce invalid JSX

1 participant