chenglou/pretext · error · Error
Unexpected TypeScript consumer error output: ${combinedOutpu
Error message
Unexpected TypeScript consumer error output:
${combinedOutput} What it means
smokeTypeScript()'s negative case correctly failed (tsc exit non-zero), but the emitted error text did not contain either of the two expected 'not assignable to parameter of type number' / 'not assignable to type number' substrings. This means a different error surfaced first, or the TS error wording changed across versions.
Source
Thrown at scripts/package-smoke-test.ts:144
[path.join(root, 'node_modules', '.bin', tscBinaryName()), '-p', 'tsconfig.json'],
{
cwd: projectDir,
stdout: 'pipe',
stderr: 'pipe',
allowFailure: true,
},
)
if (badCompile.exitCode === 0) {
throw new Error('Expected TypeScript consumer misuse to fail, but it compiled successfully.')
}
const combinedOutput = `${badCompile.stdout}${badCompile.stderr}`
if (
!combinedOutput.includes("Argument of type 'string' is not assignable to parameter of type 'number'.") &&
!combinedOutput.includes("Type 'string' is not assignable to type 'number'.")
) {
throw new Error(`Unexpected TypeScript consumer error output:\n${combinedOutput}`)
}
console.log('ts ok')
}
async function createProject(dir: string, pkg: Record<string, unknown>): Promise<void> {
await mkdir(dir, { recursive: true })
await writeFile(path.join(dir, 'package.json'), JSON.stringify(pkg, null, 2) + '\n')
}
async function installTarball(projectDir: string, tarballPath: string): Promise<void> {
run(['npm', 'install', '--ignore-scripts', '--no-package-lock', tarballPath], {
cwd: projectDir,
stdout: 'inherit',
stderr: 'inherit',
})
}
View on GitHub (pinned to ac49b09b7d)
Solutions
- Read the full combinedOutput printed in the error to see which TS diagnostic fired.
- If module/type resolution failed first, ensure the tarball installs the .d.ts files and the consumer tsconfig resolves '@chenglou/pretext'.
- If TS reworded the message, add the new wording to the accepted-substrings check at scripts/package-smoke-test.ts:140 or pin the TS version.
Defensive patterns
Strategy: try-catch
Try / catch
try {
// negative compile step
} catch (e) {
const msg = e instanceof Error ? e.message : String(e)
if (msg.includes('Unexpected TypeScript consumer error output')) {
console.error('TS error wording changed or a different error fired first. Full output:\n' + msg)
process.exit(1)
}
throw e
} Prevention
- Pin the TypeScript version used by the smoke test so error wording stays stable across upgrades.
- Ensure the consumer project resolves '@chenglou/pretext' types so a module-resolution error doesn't preempt the expected type error.
When it happens
Trigger: A newer TypeScript version reworded the assignment-error message; or the invalid program failed for a different reason (e.g. module resolution, missing types) before reaching the layout() call's type error.
Common situations: Upgrading TypeScript in the repo; the package's declarations not resolving in the consumer project so a 'cannot find module' error fires first.
Related errors
- Expected TypeScript consumer misuse to fail, but it compiled
- Expected exactly one tarball in ${packDir}, found ${tarballs
- Command failed (${result.exitCode}): ${cmd.join(' ')}
- Missing pre-wrap result for ${testCase.label}
- Invalid value for --${name}: ${raw}
AI-assisted analysis of chenglou/pretext@ac49b09b7d (2026-08-12).
Data as JSON: /api/errors/7845628bb59f2654.
Report an issue: GitHub.