From 5ec5b637f5d92e9e7ea06ff0f73c815c04eadd30 Mon Sep 17 00:00:00 2001 From: Charles Covey-Brandt Date: Mon, 11 May 2026 16:03:27 -0400 Subject: [PATCH] fix: emit .js extensions in generated schema barrel for nodenext consumers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Switch tsconfig from `module: "ESNext"` + `moduleResolution: "bundler"` to `module: "nodenext"` + `moduleResolution: "nodenext"`. As of @hey-api/openapi-ts v0.67.0, the generator respects this setting and appends `.js` to relative imports in its output — so future regenerations will produce correct nodenext-compatible code automatically. Also fix the existing `src/schema/index.ts` (auto-generated) which is missing the extension on its `from "./types.gen"` re-export. Without this fix, downstream consumers using `nodenext` resolution can't follow the `SessionInfo[]` element type through the re-export — TS resolves `ListSessionsResponse` (reachable via `acp.d.ts` which already uses the correct extension) but its `sessions` field collapses to `any` because `SessionInfo` is gated behind the broken bare-import path. Build + tests pass under nodenext. Existing internal imports already use `.js` extensions, so no other source files need updating. --- src/schema/index.ts | 2 +- tsconfig.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/schema/index.ts b/src/schema/index.ts index cd93103..c5113ec 100644 --- a/src/schema/index.ts +++ b/src/schema/index.ts @@ -240,7 +240,7 @@ export type { WorkspaceFolder, WriteTextFileRequest, WriteTextFileResponse, -} from "./types.gen"; +} from "./types.gen.js"; export const AGENT_METHODS = { authenticate: "authenticate", diff --git a/tsconfig.json b/tsconfig.json index b15b698..106a84d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,8 +9,8 @@ "declaration": true, "allowSyntheticDefaultImports": true, "lib": ["ESNext", "DOM", "DOM.Iterable"], - "module": "ESNext", - "moduleResolution": "bundler", + "module": "nodenext", + "moduleResolution": "nodenext", "target": "es2022", "types": ["node"], "rootDir": "src",