Split TypeScript emit with --noCheck
Split JavaScript emit from type checking with tsc --noCheck, then require both CI jobs before you release a build.
Your CI job runs tsc to produce JavaScript, then waits for the files before it can run a smoke test. With a straight tsc invocation, you pay for a full type check on the path to that first test. TypeScript 5.6 lets you move the check onto a separate path and keep it as a required result.
Give emit and checking separate jobs
Try the split in a scratch project with TypeScript 5.6 or later and a tsconfig.json that includes src/ticket.ts, sets rootDir to src and outDir to dist, and permits emit. Save this line in src/ticket.ts to see what happens when JavaScript can run and a type check still needs to fail.
export const ticketCount: number = '3'You have valid JavaScript once TypeScript strips the annotation, and a string where the source promises a number.
Run the first command in the build job and the second in the type-check job. Start both jobs from the same commit and give each job its own workspace.
pnpm exec tsc --noCheck
pnpm exec tsc --noEmitRun the commands in separate CI jobs, or one at a time in your terminal. The build writes dist/ticket.js. The type check exits with TS2322 on the assignment.
The compiler option skips the full type check during emit. If the package emits declarations, TypeScript can still resolve types it needs for the .d.ts files. Measure the build you ship, including its declaration settings, before budgeting time for this split.
diagram
One tsc job, or two jobs side by side
Keep the failed check visible
Make the first job publish its artifact for smoke tests, then require a green result from both paths before release. To check your job wiring, leave the bad assignment in place for one run. The build should produce the artifact, and the failed type check should block deployment even if the smoke test passes.
If you run both commands in one checkout with incremental compilation, add --tsBuildInfoFile .cache/emit.tsbuildinfo to the build command and --tsBuildInfoFile .cache/check.tsbuildinfo to the check command. Each process gets its own cache file. On a hosted runner, look at the elapsed time from push to smoke-test start as well as time to the required results. A slow queue for the new job can erase time saved by moving the check.