Skip to content

fix(driver-sql): resolve knex DTS build failure via tsconfig paths#969

Merged
hotlong merged 2 commits into
mainfrom
copilot/fix-ci-build-and-test-errors-again
Mar 23, 2026
Merged

fix(driver-sql): resolve knex DTS build failure via tsconfig paths#969
hotlong merged 2 commits into
mainfrom
copilot/fix-ci-build-and-test-errors-again

Conversation

Copilot AI commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

@objectstack/driver-sql DTS build fails because knex v3.2.3 declares ./types/index.d.mts in its package.json exports (import condition) but the file doesn't exist. With moduleResolution: "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

  • Added paths mapping in packages/plugins/driver-sql/tsconfig.json to point TypeScript at the correct knex/types/index.d.ts:
"paths": {
  "knex": ["./node_modules/knex/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

fix all ci build and test errors


💡 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.

@vercel

vercel Bot commented Mar 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
objectstack-play Ready Ready Preview, Comment Mar 23, 2026 10:32am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
spec Ignored Ignored Mar 23, 2026 10:32am

Request Review

…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
Copilot AI changed the title [WIP] Fix all CI build and test errors fix(driver-sql): resolve knex DTS build failure via tsconfig paths Mar 23, 2026
Copilot AI requested a review from hotlong March 23, 2026 10:34
@hotlong
hotlong marked this pull request as ready for review March 23, 2026 10:41
Copilot AI review requested due to automatic review settings March 23, 2026 10:41
@hotlong
hotlong merged commit 3a3c448 into main Mar 23, 2026
3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.paths mapping in packages/plugins/driver-sql/tsconfig.json to force resolution of knex types to knex/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.

Comment on lines +14 to +17
"forceConsistentCasingInFileNames": true,
"paths": {
"knex": ["./node_modules/knex/types/index.d.ts"]
}

Copilot AI Mar 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants