{"record":{"id":"7845628bb59f2654","repo":"chenglou/pretext","slug":"unexpected-typescript-consumer-error-output-com","errorCode":null,"errorMessage":"Unexpected TypeScript consumer error output:\n${combinedOutput}","messagePattern":"Unexpected TypeScript consumer error output:\n(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/package-smoke-test.ts","lineNumber":144,"sourceCode":"    [path.join(root, 'node_modules', '.bin', tscBinaryName()), '-p', 'tsconfig.json'],\n    {\n      cwd: projectDir,\n      stdout: 'pipe',\n      stderr: 'pipe',\n      allowFailure: true,\n    },\n  )\n\n  if (badCompile.exitCode === 0) {\n    throw new Error('Expected TypeScript consumer misuse to fail, but it compiled successfully.')\n  }\n\n  const combinedOutput = `${badCompile.stdout}${badCompile.stderr}`\n  if (\n    !combinedOutput.includes(\"Argument of type 'string' is not assignable to parameter of type 'number'.\") &&\n    !combinedOutput.includes(\"Type 'string' is not assignable to type 'number'.\")\n  ) {\n    throw new Error(`Unexpected TypeScript consumer error output:\\n${combinedOutput}`)\n  }\n\n  console.log('ts ok')\n}\n\nasync function createProject(dir: string, pkg: Record<string, unknown>): Promise<void> {\n  await mkdir(dir, { recursive: true })\n  await writeFile(path.join(dir, 'package.json'), JSON.stringify(pkg, null, 2) + '\\n')\n}\n\nasync function installTarball(projectDir: string, tarballPath: string): Promise<void> {\n  run(['npm', 'install', '--ignore-scripts', '--no-package-lock', tarballPath], {\n    cwd: projectDir,\n    stdout: 'inherit',\n    stderr: 'inherit',\n  })\n}\n","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/chenglou/pretext/blob/ac49b09b7d83ede19581fa94a8b892b07d309baf/scripts/package-smoke-test.ts#L126-L162","documentation":"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.","triggerScenarios":"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.","commonSituations":"Upgrading TypeScript in the repo; the package's declarations not resolving in the consumer project so a 'cannot find module' error fires first.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  // negative compile step\n} catch (e) {\n  const msg = e instanceof Error ? e.message : String(e)\n  if (msg.includes('Unexpected TypeScript consumer error output')) {\n    console.error('TS error wording changed or a different error fired first. Full output:\\n' + msg)\n    process.exit(1)\n  }\n  throw e\n}","preventionTips":["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."],"tags":["typescript","type-declarations","smoke-test","version-compat"],"backgroundTag":null,"analyzedSha":"ac49b09b7d83ede19581fa94a8b892b07d309baf","analyzedAt":"2026-08-12T17:03:16.263Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}