Skip to content

Fix silent empty output when schema generation fails - #489

Open
silviogutierrez wants to merge 1 commit into
mainfrom
fix/silent-empty-generated-types
Open

silviogutierrez wants to merge 1 commit into
mainfrom
fix/silent-empty-generated-types

Conversation

@silviogutierrez

Copy link
Copy Markdown
Owner

generate_types.py piped the schema through json2ts without checking the exit code. When json2ts fails to resolve or run (a broken or partially installed node_modules, for example), the script wrote a zero-byte generated.tsx and exited 0 — so the failure only surfaced later, deep in tsc, as a wall of "generated.tsx is not a module" and implicit-any errors pointing nowhere near the cause.

Now the script fails at the source with the real exit code, and never overwrites generated.tsx with empty output. Includes a test that stubs a failing npm and asserts both the refusal and that any existing generated.tsx is left untouched.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PKZUt2VP1HPLdXzR7fnmwk

generate_types.py never checked the json2ts exit code: any failure to
resolve or run it wrote a zero-byte generated.tsx and exited 0, so the
build only failed later, deep in tsc, with dozens of misleading
'generated.tsx is not a module' errors. Fail at the source instead, and
never overwrite generated.tsx with empty output.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PKZUt2VP1HPLdXzR7fnmwk

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.

1 participant