fix: CLI tsx conversion crashes — pass { rawEasy } to convertRawEasyToTsx - #401
Open
chayan-1906 wants to merge 3 commits into
Open
fix: CLI tsx conversion crashes — pass { rawEasy } to convertRawEasyToTsx#401chayan-1906 wants to merge 3 commits into
chayan-1906 wants to merge 3 commits into
Conversation
convertRawEasyToTsx expects an object with a rawEasy property, but the CLI passed the raw EasyEDA JSON directly, so rawEasy destructured to undefined and EasyEdaJsonSchema.parse crashed for every part when converting to .tsx/.ts output. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018TPt9rFF6Uo76scbFcoyZ4
Exercises the .tsx output path of convertEasyEdaJsonToVariousFormats using a local test asset (no network). Fails on main with the "expected object, received undefined" ZodError and passes with the fix. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018TPt9rFF6Uo76scbFcoyZ4
The library examples still showed the old direct-argument call, which fails the same way as the CLI did. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018TPt9rFF6Uo76scbFcoyZ4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #400
Problem
easyeda convert -i <part> -o <file>.tsxcrashed for every part number — even the README's own example:Fix
convertEasyEdaJsonToVariousFormatspassed the raw EasyEDA JSON directly toconvertRawEasyToTsx, which expects{ rawEasy }— sorawEasydestructured toundefinedandEasyEdaJsonSchema.parsethrew. One-line change:TypeScript can't catch this because the input can come from
JSON.parse(typedany).Also updated the two README library examples that still showed the old
convertRawEasyEdaToTs(rawEasyJson)calling convention.Testing
tests/convert-easyeda-json-to-various-formats.test.ts: converts a localtests/assets/C46749.raweasy.jsonto tsx (no network needed). It fails on currentmainwith the exact ZodError above and passes with this fix.bun test— suite green (the only failures ever observed were pre-existing 5s network timeouts inconvert-to-tstests, which also occur on cleanmainand pass when run in isolation)bun run format:check✅bunx tsc --noEmit✅bun run build✅.tsxoutput.🤖 Generated with Claude Code
https://claude.ai/code/session_018TPt9rFF6Uo76scbFcoyZ4