fix(driver-sql): resolve knex DTS build failure via tsconfig paths#969
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…g paths Knex v3.2.3 declares `./types/index.d.mts` in its package.json exports for the ESM import condition, but that file does not exist. With moduleResolution: "bundler", TypeScript cannot find the knex type declarations, causing TS7016 and cascading TS7006 errors during DTS generation. Add a `paths` mapping in driver-sql's tsconfig.json to direct TypeScript to the correct `knex/types/index.d.ts` file. This resolves the DTS build failure and all downstream cascade failures. Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com> Agent-Logs-Url: https://github.com/objectstack-ai/spec/sessions/7907d926-5f9d-4f66-adda-71b672e1ff6e
There was a problem hiding this comment.
Pull request overview
This PR addresses a TypeScript declaration (DTS) build failure in @objectstack/driver-sql caused by knex v3.2.3 advertising a non-existent types entry in its exports, which breaks type resolution under moduleResolution: "bundler" and cascades into downstream package build failures.
Changes:
- Added a TypeScript
compilerOptions.pathsmapping inpackages/plugins/driver-sql/tsconfig.jsonto force resolution of knex types toknex/types/index.d.ts. - Documented the fix and its impact in
CHANGELOG.md.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/plugins/driver-sql/tsconfig.json | Adds a paths mapping intended to work around broken knex type exports during DTS generation. |
| CHANGELOG.md | Adds an Unreleased “Fixed” entry describing the knex DTS/type-resolution build fix. |
| "forceConsistentCasingInFileNames": true, | ||
| "paths": { | ||
| "knex": ["./node_modules/knex/types/index.d.ts"] | ||
| } |
There was a problem hiding this comment.
compilerOptions.paths requires compilerOptions.baseUrl to be set; otherwise TypeScript errors ("Option 'paths' cannot be specified without specifying option 'baseUrl'") and the build will still fail. Add an explicit baseUrl (typically ".") in this tsconfig so the knex mapping is applied correctly.
@objectstack/driver-sqlDTS build fails because knex v3.2.3 declares./types/index.d.mtsin its package.jsonexports(import condition) but the file doesn't exist. WithmoduleResolution: "bundler", TypeScript can't resolve knex types, producing TS7016 and cascading TS7006 errors. This breaks the build of driver-sql and all 16+ downstream packages.Fix
pathsmapping inpackages/plugins/driver-sql/tsconfig.jsonto point TypeScript at the correctknex/types/index.d.ts:This is the standard workaround for packages with broken ESM type exports. The mapping is only used at build time and does not affect consumers of the published package.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.