Problem
@webjsdev/core ships an index.d.ts overlay, but @webjsdev/server ships no .d.ts and no types export condition in its package.json. So under strict + nodenext, a TypeScript app's import { createRequestHandler, cors, cache, createAuth, rateLimit, sitemap, validateInput, revalidatePath, ... } from '@webjsdev/server' emits TS7016 ("Could not find a declaration file for module '@webjsdev/server'").
This was surfaced while building #265 (the webjs typecheck command) and #267 (the handle() test harness): it is exactly why #265 deliberately did NOT wire npm run typecheck into the scaffold CI as a hard gate, because a fresh scaffold would fail it on the server import. It also means the Next.js migration guide (#273) and the recipes (#272) show @webjsdev/server imports that are currently untyped, and every TS webjs app gets any/an error for a first-party module the docs push as the API.
Design / approach
Add a types-only overlay for the public @webjsdev/server surface, the same posture @webjsdev/core uses (index.d.ts re-exporting from per-file .d.ts, erased at runtime, zero build cost). Type what packages/server/index.js actually exports, matching the runtime, never an idealized superset. Candidates: createRequestHandler / startServer, cors, cache / revalidateTag / revalidatePath / revalidateAll, createAuth / Credentials / Session, rateLimit, setStore / redisStore / memoryStore, sitemap / sitemapIndex, generateRouteTypes, the @webjsdev/server/testing helpers, and the @webjsdev/server/check subpath. Add a types condition to each exports subpath in package.json so editors and tsc resolve it. Keep it in lockstep with index.js (a drift guard test, like the #259 WebjsConfig schema/type lockstep).
Acceptance criteria
Surfaced from the production-readiness work (#265 typecheck, #267 test harness). Theme: types. Priority: P1. Kept to webjs identity: no-build, types-only overlay, erased at runtime.
Problem
@webjsdev/coreships anindex.d.tsoverlay, but@webjsdev/serverships no.d.tsand notypesexport condition in itspackage.json. So understrict+nodenext, a TypeScript app'simport { createRequestHandler, cors, cache, createAuth, rateLimit, sitemap, validateInput, revalidatePath, ... } from '@webjsdev/server'emits TS7016 ("Could not find a declaration file for module '@webjsdev/server'").This was surfaced while building #265 (the
webjs typecheckcommand) and #267 (thehandle()test harness): it is exactly why #265 deliberately did NOT wirenpm run typecheckinto the scaffold CI as a hard gate, because a fresh scaffold would fail it on the server import. It also means the Next.js migration guide (#273) and the recipes (#272) show@webjsdev/serverimports that are currently untyped, and every TS webjs app getsany/an error for a first-party module the docs push as the API.Design / approach
Add a types-only overlay for the public
@webjsdev/serversurface, the same posture@webjsdev/coreuses (index.d.tsre-exporting from per-file.d.ts, erased at runtime, zero build cost). Type whatpackages/server/index.jsactually exports, matching the runtime, never an idealized superset. Candidates:createRequestHandler/startServer,cors,cache/revalidateTag/revalidatePath/revalidateAll,createAuth/Credentials/Session,rateLimit,setStore/redisStore/memoryStore,sitemap/sitemapIndex,generateRouteTypes, the@webjsdev/server/testinghelpers, and the@webjsdev/server/checksubpath. Add atypescondition to eachexportssubpath inpackage.jsonso editors andtscresolve it. Keep it in lockstep withindex.js(a drift guard test, like the #259WebjsConfigschema/type lockstep).Acceptance criteria
@webjsdev/serverships a types overlay so a strict TS app'simport ... from '@webjsdev/server'no longer emits TS7016package.jsonexportscarry atypescondition for the main entry and each subpath (/testing,/check)index.jsactually exports (a drift test asserts no missing/extra export), never a supersetnpm run typecheckcan be wired into the scaffold CI without failing on the server import (revisit Add a webjs typecheck command (tsc --noEmit wrapper) #265's deferred CI gate)tsc --noEmitfixture importing the server surface compiles clean)Surfaced from the production-readiness work (#265 typecheck, #267 test harness). Theme: types. Priority: P1. Kept to webjs identity: no-build, types-only overlay, erased at runtime.