generateTypescriptComponent interpolates manufacturerPartNumber directly into a plain double-quoted JSX attribute for every generated component type (chip, diode, led, pushbutton, switch, capacitor, resistor, inductor, crystal, connector):
manufacturerPartNumber="${manufacturerPartNumber}"
JSX quoted attributes do not interpret JavaScript escape sequences, so a manufacturer part number containing a double quote produces an unterminated string literal and the generated TSX fails to parse.
Repro
import { EasyEdaJsonSchema } from "lib/schemas/easy-eda-json-schema"
import { convertBetterEasyToTsx } from "lib/websafe/convert-to-typescript-component"
import c1046RawEasy from "./tests/assets/C1046.raweasy.json"
const payload = structuredClone(c1046RawEasy)
payload.dataStr.head.c_para["Manufacturer Part"] = 'ABC"DEF'
const betterEasy = EasyEdaJsonSchema.parse(payload)
const result = await convertBetterEasyToTsx({ betterEasy })
console.log(result)
Generated output contains:
manufacturerPartNumber="ABC"DEF"
which is not valid JSX and fails to parse (confirmed with the TypeScript compiler's source-file parser).
Observed
Invalid TSX is generated for any manufacturer part number containing a double quote (or a backslash, or {/}), and the file fails to parse/compile.
Expected
The generated TSX should always be syntactically valid, with the value safely escaped regardless of its contents (matching the JSON.stringify-based escaping already used for other string props such as supplierPartNumbers and pin labels in the same file).
Reproduced against 9bc41b72988261b6c2225e73d977ae82e897669b (main).
generateTypescriptComponentinterpolatesmanufacturerPartNumberdirectly into a plain double-quoted JSX attribute for every generated component type (chip, diode, led, pushbutton, switch, capacitor, resistor, inductor, crystal, connector):JSX quoted attributes do not interpret JavaScript escape sequences, so a manufacturer part number containing a double quote produces an unterminated string literal and the generated TSX fails to parse.
Repro
Generated output contains:
which is not valid JSX and fails to parse (confirmed with the TypeScript compiler's source-file parser).
Observed
Invalid TSX is generated for any manufacturer part number containing a double quote (or a backslash, or
{/}), and the file fails to parse/compile.Expected
The generated TSX should always be syntactically valid, with the value safely escaped regardless of its contents (matching the
JSON.stringify-based escaping already used for other string props such assupplierPartNumbersand pin labels in the same file).Reproduced against
9bc41b72988261b6c2225e73d977ae82e897669b(main).