unknown
Root cause. src/index.ts exports DecisionType as a type only (export type DecisionType = "text" | "end"). Under verbatimModuleSyntax/isolatedModules it is erased at compile time. The AGENTS.md quickstart imported it as a runtime value and dereferenced its members — Node's ESM loader throws at module instantiation:
SyntaxError: The requested module './src/index.ts' does not provide an export named 'DecisionType'
The fix (mirrors README GAP-003), three parts:
import type:import type { Harness } from "typescript-docs";
import type { Decision } from "typescript-docs";
const harness: Harness = {
run(decision: Decision) {
if (decision.type === "text") { // was: DecisionType.TEXT
console.log(`text: ${decision.text}`);
} else if (decision.type === "end") { // was: DecisionType.END
console.log("end");
}
},
};
await harness.run({ type: "text", text: "hello" });
await harness.run({ type: "end" });
## GAP-003 section in README.md documenting that DecisionType has no runtime representation (prose-only; no literal member names so the grep criterion stays clean).Repo: ~/typescript-docs (src/index.ts, src/index.test.ts, AGENTS.md, README.md, scripts/verify-quickstart.mjs).
All four criteria verified (run from `~/typescript-docs`): | Check | Result | |---|---| | `grep -rnE 'DecisionType\.(TEXT\|END)' .` (excl. node_modules/.git) | **0 matches** | | Extract quickstart code block → swap package import for `./src/index.ts` → `npx tsx` | **exit 0**, output `text: hello` / `end` | | `npx vitest run` | **3/3 passed** | | `npx tsc --noEmit` (verbatimModuleSyntax, strict) | **exit 0** | The quickstart verification is automated in `scripts/verify-quickstart.mjs` (extracts the ```` ```ts ```` block under `## Quickstart`, asserts it imports `"typescript-docs"`, swaps to `./src/index.ts`, rejects any `DecisionType.TEXT|END` usage, writes the result as gitignored `.mts` at project root so `./src/index.ts` resolves and top-level await is legal, runs tsx, cleans up). **Edge cases tested (negative controls):** - Old broken pattern at runtime: reproduces the exact documented failure — `SyntaxError` at module load (`does not provide an export named 'DecisionType'`), exit 1. - Old broken pattern type-checked: `TS1484: 'DecisionType' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled` — the compiler guard that keeps the docs honest. - `"./src/index.ts"` has zero runtime exports (`"DecisionType" in mod === false`), asserting the type-only contract itself. - Temp-file handling: `.mts` extension forces ESM (top-level await rejected as CJS otherwise); file cleaned up after run; `.gitignore` excludes it.
{"model": "deepseek-v4-flash", "result": "completed"}Root cause. src/index.ts exports DecisionType as a type only (export type DecisionType = "text" | "end"). Under verbatimModuleSyntax/isolatedModules it is erased at compile time. The AGENTS.md quickstart imported it as a runtime value and dereferenced its members — Node's ESM loader throws at module instantiation:
SyntaxError: The requested module './src/index.ts' does not provide an export named 'DecisionType'
The fix (mirrors README GAP-003), three parts:
import type:import type { Harness } from "typescript-docs";
import type { Decision } from "typescript-docs";
const harness: Harness = {
run(decision: Decision) {
if (decision.type === "text") { // was: DecisionType.TEXT
console.log(`text: ${decision.text}`);
} else if (decision.type === "end") { // was: DecisionType.END
console.log("end");
}
},
};
await harness.run({ type: "text", text: "hello" });
await harness.run({ type: "end" });
## GAP-003 section in README.md documenting that DecisionType has no runtime representation (prose-only; no literal member names so the grep criterion stays clean).Repo: ~/typescript-docs (src/index.ts, src/index.test.ts, AGENTS.md, README.md, scripts/verify-quickstart.mjs).
All four criteria verified (run from `~/typescript-docs`): | Check | Result | |---|---| | `grep -rnE 'DecisionType\.(TEXT\|END)' .` (excl. node_modules/.git) | **0 matches** | | Extract quickstart code block → swap package import for `./src/index.ts` → `npx tsx` | **exit 0**, output `text: hello` / `end` | | `npx vitest run` | **3/3 passed** | | `npx tsc --noEmit` (verbatimModuleSyntax, strict) | **exit 0** | The quickstart verification is automated in `scripts/verify-quickstart.mjs` (extracts the ```` ```ts ```` block under `## Quickstart`, asserts it imports `"typescript-docs"`, swaps to `./src/index.ts`, rejects any `DecisionType.TEXT|END` usage, writes the result as gitignored `.mts` at project root so `./src/index.ts` resolves and top-level await is legal, runs tsx, cleans up). **Edge cases tested (negative controls):** - Old broken pattern at runtime: reproduces the exact documented failure — `SyntaxError` at module load (`does not provide an export named 'DecisionType'`), exit 1. - Old broken pattern type-checked: `TS1484: 'DecisionType' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled` — the compiler guard that keeps the docs honest. - `"./src/index.ts"` has zero runtime exports (`"DecisionType" in mod === false`), asserting the type-only contract itself. - Temp-file handling: `.mts` extension forces ESM (top-level await rejected as CJS otherwise); file cleaned up after run; `.gitignore` excludes it.
{"model": "deepseek-v4-flash", "result": "completed"}