Problem
When TS codegen is invoked with `typecheck: true`, `tsc` runs inside `typescript::generate()` after the source is built but before it's returned. If tsc fails for any reason (including environmental failures like missing `node_modules` in a fresh worktree), the generated source is discarded and the CLI exits non-zero.
In a multi-language build script (`reflectapi codegen --language typescript && reflectapi codegen --language python`), this means a transient TS env issue blocks Python emission entirely. Reported by an internal consumer who hit this on a fresh worktree.
Suggested fix
Two options:
- Emit-then-validate: write the generated file first, then run `tsc --noEmit` against it. tsc failure becomes a non-zero exit but the file is still on disk for downstream tooling.
- Multi-language CLI mode: `reflectapi codegen --language typescript,python` accumulates per-language errors and exits at the end. Simpler for orchestration but doesn't help users invoking once-per-language.
(1) is the smaller change; (2) is a nicer DX add-on.
Problem
When TS codegen is invoked with `typecheck: true`, `tsc` runs inside `typescript::generate()` after the source is built but before it's returned. If tsc fails for any reason (including environmental failures like missing `node_modules` in a fresh worktree), the generated source is discarded and the CLI exits non-zero.
In a multi-language build script (`reflectapi codegen --language typescript && reflectapi codegen --language python`), this means a transient TS env issue blocks Python emission entirely. Reported by an internal consumer who hit this on a fresh worktree.
Suggested fix
Two options:
(1) is the smaller change; (2) is a nicer DX add-on.