…aying `any`
The generated Stack API reference documents 13 types as `any` and gives
AuthStrategy the wrong description entirely. Both come from one missing
compiler option.
@cipherstash/protect-ffi's `exports` map routes the `node` condition to
lib/index.d.cts (the real type surface) and everything else to
`default: ./dist/wasm/protect_ffi.js`, which ships no `types`. TypeScript
therefore falls through to the sibling dist/wasm/protect_ffi.d.ts — raw
wasm-bindgen output — where none of the hand-written types exist.
`moduleResolution: "bundler"` does not imply the `node` condition;
packages/stack/tsconfig.json adds `customConditions: ["node"]`, which is why
the stack team never sees this. But typedoc.tsconfig.json extends stack's ROOT
tsconfig, which does not set it. Set it on the generated config.
Confirmed with a minimal repro against protect-ffi 0.30.0 (the version stack
1.0.0-rc.4 pins exactly): `moduleResolution: bundler` alone yields
"has no exported member 'ProtectError'. Did you mean 'encryptQuery'?"; adding
customConditions typechecks clean.
Also turns error checking back on. It was disabled to tolerate this, on the
theory that the references were "unresolved even though the source is correct"
and TypeDoc would still emit accurate signatures. It does not — an unresolved
import becomes `any` in the output, so the workaround converted a loud failure
into a silently wrong reference. With the condition fixed the surface
typechecks with 0 errors, so the next resolution break fails the build instead.
Generating with and without the fix, back to back against the same stack tag,
changes 23 pages. Representative:
EncryptionError.code any -> ProtectErrorCode
EncryptQueryOperation.execute() Promise<Result<any, ...>>
-> Promise<Result<EncryptedQueryResult, ...>>
encryptQuery plaintext param any -> Plaintext | null | undefined
AuthStrategy description the module's blurb -> the type's own docs
Claude-Session: https://claude.ai/code/session_01NkuQNMvw9BpB4BWWeKtfV8
Found while debugging why #76 fails CI on main. The build failure turned out to be the visible half of a bug that is also silently degrading the published Stack reference on v2.
The bug
@cipherstash/protect-ffi's exports["."] is conditional, and the fallback branch has no types:
{ "node": { "import": { "types": "./lib/index.d.mts", "default": "./lib/index.mjs" }, "require": { "types": "./lib/index.d.cts", "default": "./lib/index.cjs" } }, "default": "./dist/wasm/protect_ffi.js" }moduleResolution: "bundler" does not imply the node condition — you need customConditions: ["node"]. packages/stack/tsconfig.json sets exactly that, which is why the stack team never hits this. But typedoc.tsconfig.json extends stack's root tsconfig, which doesn't. So TypeScript misses the node branch, falls to default, finds no types, and resolves the sibling dist/wasm/protect_ffi.d.ts — raw wasm-bindgen output, where none of the hand-written types exist.
Hence the giveaway in the error text: "has no exported member EncryptedV3Query. Did you mean encryptQuery?"
Minimal repro against protect-ffi 0.30.0 — the version stack 1.0.0-rc.4 pins exactly, so this is not resolution drift:
Why this matters beyond the build
On v2 the errors were hidden by skipErrorChecking: true, whose comment said the references were "unresolved even though the source is correct" and that "TypeDoc still emits accurate signatures from the source AST".
That last part isn't true. An unresolved import doesn't just warn — TypeDoc emits any. So the workaround converted a loud build failure into a silently wrong reference. Generating with and without the fix back-to-back against the same stack tag changes 23 pages, including 13 anys:
So this is a docs-accuracy fix first and a build fix second.
Changes
Verified
bun run generate-docs → exit 0, Found 0 errors and 7 warnings, no error TS lines. biome check clean. The 23-page diff was produced by two back-to-back runs against the same stack tag, so it is attributable to this change and not to upstream movement.
Follow-ups, not in this PR
https://claude.ai/code/session_01NkuQNMvw9BpB4BWWeKtfV8