Skip to content

fix: resolve dangling .d.ts imports across packages (#920)#922

Merged
AlemTuzlak merged 1 commit into
TanStack:mainfrom
harshlocham:fix/dangling-dts-imports-920
Jul 9, 2026
Merged

fix: resolve dangling .d.ts imports across packages (#920)#922
AlemTuzlak merged 1 commit into
TanStack:mainfrom
harshlocham:fix/dangling-dts-imports-920

Conversation

@harshlocham

@harshlocham harshlocham commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Fixes #920.

Published packages were emitting dangling relative imports in dist/**/*.d.ts (e.g. '../utils.js' for a directory barrel that builds to utils/index.js). Under bundler / node16 / nodenext resolution, those specifiers don't resolve, and with skipLibCheck: true consumer types silently degrade to any.

This PR:

Fixes 29 dangling declaration imports across 10 packages by switching barrel imports to concrete module paths (matching the ai-openai pattern: ../utils/client, ../middleware/run, ./tools/index, etc.)
Adds scripts/scan-dangling-dts.mjs and wires pnpm test:dts into test:pr / test:ci so this can't regress
Removes 5 orphaned barrel index.ts files left unused after the import cleanup (knip)
Runs verify-links via tsx instead of node (TypeScript script)
Packages touched
@tanstack/ai, @tanstack/ai-anthropic, @tanstack/ai-bedrock, @tanstack/ai-fal, @tanstack/ai-gemini, @tanstack/ai-grok, @tanstack/ai-groq, @tanstack/ai-mistral, @tanstack/ai-ollama, @tanstack/ai-openrouter

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Bug Fixes
    • Improved published TypeScript declarations so generated packages resolve imports correctly in common module resolution modes.
    • Reduced the chance of broken package builds caused by unresolved relative imports.
  • Chores
    • Added a new declaration-checking verification step to test and CI workflows.
    • Updated package entry points to use more specific export paths for better consistency.

Switch directory-barrel imports (`../utils`, `../tools`, `../middleware`)
to concrete module paths so published declaration files resolve under
bundler/node16/nodenext. Remove orphaned barrel index files, add a
`test:dts` scanner guardrail, and run `verify-links` via tsx.
@harshlocham harshlocham requested a review from a team as a code owner July 9, 2026 13:02
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cfa81003-6fa7-4a35-b2e2-19cecce77dcb

📥 Commits

Reviewing files that changed from the base of the PR and between de5fbb5 and 1f9a170.

📒 Files selected for processing (36)
  • .changeset/tender-otters-tease.md
  • package.json
  • packages/ai-anthropic/src/adapters/summarize.ts
  • packages/ai-anthropic/src/adapters/text.ts
  • packages/ai-anthropic/src/index.ts
  • packages/ai-anthropic/src/text/text-provider-options.ts
  • packages/ai-anthropic/src/utils/index.ts
  • packages/ai-bedrock/src/index.ts
  • packages/ai-bedrock/src/utils/index.ts
  • packages/ai-fal/src/adapters/audio.ts
  • packages/ai-fal/src/adapters/image.ts
  • packages/ai-fal/src/adapters/speech.ts
  • packages/ai-fal/src/adapters/transcription.ts
  • packages/ai-fal/src/adapters/video.ts
  • packages/ai-fal/src/index.ts
  • packages/ai-gemini/src/experimental/text-interactions/adapter.ts
  • packages/ai-grok/src/adapters/image.ts
  • packages/ai-grok/src/adapters/summarize.ts
  • packages/ai-grok/src/adapters/text.ts
  • packages/ai-grok/src/adapters/video.ts
  • packages/ai-groq/src/adapters/text.ts
  • packages/ai-groq/src/adapters/tts.ts
  • packages/ai-groq/src/utils/index.ts
  • packages/ai-mistral/src/adapters/text.ts
  • packages/ai-mistral/src/tools/index.ts
  • packages/ai-mistral/src/utils/index.ts
  • packages/ai-ollama/src/index.ts
  • packages/ai-openrouter/src/adapters/image.ts
  • packages/ai-openrouter/src/index.ts
  • packages/ai/src/activities/generateAudio/index.ts
  • packages/ai/src/activities/generateImage/index.ts
  • packages/ai/src/activities/generateSpeech/index.ts
  • packages/ai/src/activities/generateTranscription/index.ts
  • packages/ai/src/activities/generateVideo/index.ts
  • packages/ai/src/realtime/types.ts
  • scripts/scan-dangling-dts.mjs
💤 Files with no reviewable changes (5)
  • packages/ai-mistral/src/tools/index.ts
  • packages/ai-anthropic/src/utils/index.ts
  • packages/ai-mistral/src/utils/index.ts
  • packages/ai-bedrock/src/utils/index.ts
  • packages/ai-groq/src/utils/index.ts

📝 Walkthrough

Walkthrough

Multiple @tanstack/ai* packages update relative imports that previously referenced directory barrels (../utils, ../tools, ../middleware) to concrete module paths, fixing dangling .d.ts import resolution under bundler/node16/nodenext. Some barrel index files remove now-redundant re-exports. A new scripts/scan-dangling-dts.mjs guardrail script scans built .d.ts files for unresolved relative specifiers, wired into test:pr/test:ci/nx scripts as test:dts. A changeset records patch releases.

Changes

Dangling .d.ts import path fixes and scanner guardrail

Layer / File(s) Summary
Dangling-import scanner and CI wiring
scripts/scan-dangling-dts.mjs, package.json, .changeset/tender-otters-tease.md
New script walks built dist/**/*.d.ts files, detects unresolved relative import specifiers, prints findings, and exits non-zero on failures; wired into test:pr, test:ci, and nx.includedScripts as test:dts; changeset documents patch bumps for affected packages.
ai-anthropic barrel import fixes
packages/ai-anthropic/src/adapters/summarize.ts, .../text.ts, .../index.ts, .../text/text-provider-options.ts
Adapter and index files switch ../utils/../tools imports to concrete ../utils/client, ../tools/code-execution-tool, and ./tools/index paths.
ai-bedrock client re-export fixes
packages/ai-bedrock/src/index.ts, .../utils/index.ts
Index re-exports and type imports switch to ./utils/client; utils/index.ts drops the redundant barrel re-export.
ai-fal adapters/index client-billing split
packages/ai-fal/src/adapters/{audio,image,speech,transcription,video}.ts, .../index.ts
Utility imports split between ../utils/client and ../utils/billing; index re-exports moved to ./utils/client.
ai-gemini experimental adapter fix
packages/ai-gemini/src/experimental/text-interactions/adapter.ts
Client/type imports switched from ../../utils to ../../utils/client, completing a previously missed fix.
ai-grok adapter fixes
packages/ai-grok/src/adapters/{image,summarize,text,video}.ts
GrokClientConfig/getGrokApiKeyFromEnv imports switched from ../utils to ../utils/client.
ai-groq adapter and barrel removal
packages/ai-groq/src/adapters/{text,tts}.ts, .../utils/index.ts
Adapters switch GroqClientConfig import to ../utils/client; utils barrel drops client/schema-converter/generateId re-exports.
ai-mistral adapter and barrel removals
packages/ai-mistral/src/adapters/text.ts, .../tools/index.ts, .../utils/index.ts
Text adapter uses concrete tool-converter/client/schema-converter paths; tools and utils barrels drop redundant re-exports.
ai-openrouter adapter and index fixes
packages/ai-openrouter/src/adapters/image.ts, .../index.ts
Client and tool type re-exports switched to ../utils/client and ./tools/index.
ai core middleware import fixes
packages/ai/src/activities/{generateAudio,generateImage,generateSpeech,generateTranscription,generateVideo}/index.ts, .../realtime/types.ts
Middleware helper and GenerationMiddleware/UsageInfo type imports switched from ../middleware barrel to ../middleware/run and ../middleware/types.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related issues

Possibly related PRs

  • TanStack/ai#665: Directly modifies packages/ai-bedrock utils/index.ts and index.ts re-export wiring in the same way as this PR.
  • TanStack/ai#805: Changes the same test:pr/test:ci script wiring in package.json alongside this PR's test:dts addition.
  • TanStack/ai#919: Prior fix for Gemini adapters switching GeminiClientConfig from ../utils to ../utils/client, which this PR extends to the missed file and other packages.

Suggested reviewers: AlemTuzlak, tombeckenham

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main fix and matches the linked issue scope.
Description check ✅ Passed The PR description follows the template with Changes, Checklist, and Release Impact sections filled out.
Linked Issues check ✅ Passed The PR addresses the main issue goals: fixes the dangling declaration imports, adds the d.ts scanner guardrail, and covers the missed Gemini file.
Out of Scope Changes check ✅ Passed The added script, CI wiring, and barrel cleanup all align with the stated objectives and no unrelated changes stand out.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nx-cloud

nx-cloud Bot commented Jul 9, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 1f9a170

Command Status Duration Result
nx run-many --targets=build --exclude=examples/... ✅ Succeeded 1m 33s View ↗

☁️ Nx Cloud last updated this comment at 2026-07-09 14:15:52 UTC

@pkg-pr-new

pkg-pr-new Bot commented Jul 9, 2026

Copy link
Copy Markdown

Open in StackBlitz

@tanstack/ai

npm i https://pkg.pr.new/@tanstack/ai@922

@tanstack/ai-acp

npm i https://pkg.pr.new/@tanstack/ai-acp@922

@tanstack/ai-angular

npm i https://pkg.pr.new/@tanstack/ai-angular@922

@tanstack/ai-anthropic

npm i https://pkg.pr.new/@tanstack/ai-anthropic@922

@tanstack/ai-bedrock

npm i https://pkg.pr.new/@tanstack/ai-bedrock@922

@tanstack/ai-claude-code

npm i https://pkg.pr.new/@tanstack/ai-claude-code@922

@tanstack/ai-client

npm i https://pkg.pr.new/@tanstack/ai-client@922

@tanstack/ai-code-mode

npm i https://pkg.pr.new/@tanstack/ai-code-mode@922

@tanstack/ai-code-mode-skills

npm i https://pkg.pr.new/@tanstack/ai-code-mode-skills@922

@tanstack/ai-codex

npm i https://pkg.pr.new/@tanstack/ai-codex@922

@tanstack/ai-devtools-core

npm i https://pkg.pr.new/@tanstack/ai-devtools-core@922

@tanstack/ai-elevenlabs

npm i https://pkg.pr.new/@tanstack/ai-elevenlabs@922

@tanstack/ai-event-client

npm i https://pkg.pr.new/@tanstack/ai-event-client@922

@tanstack/ai-fal

npm i https://pkg.pr.new/@tanstack/ai-fal@922

@tanstack/ai-gemini

npm i https://pkg.pr.new/@tanstack/ai-gemini@922

@tanstack/ai-grok

npm i https://pkg.pr.new/@tanstack/ai-grok@922

@tanstack/ai-grok-build

npm i https://pkg.pr.new/@tanstack/ai-grok-build@922

@tanstack/ai-groq

npm i https://pkg.pr.new/@tanstack/ai-groq@922

@tanstack/ai-isolate-cloudflare

npm i https://pkg.pr.new/@tanstack/ai-isolate-cloudflare@922

@tanstack/ai-isolate-node

npm i https://pkg.pr.new/@tanstack/ai-isolate-node@922

@tanstack/ai-isolate-quickjs

npm i https://pkg.pr.new/@tanstack/ai-isolate-quickjs@922

@tanstack/ai-mcp

npm i https://pkg.pr.new/@tanstack/ai-mcp@922

@tanstack/ai-mistral

npm i https://pkg.pr.new/@tanstack/ai-mistral@922

@tanstack/ai-ollama

npm i https://pkg.pr.new/@tanstack/ai-ollama@922

@tanstack/ai-openai

npm i https://pkg.pr.new/@tanstack/ai-openai@922

@tanstack/ai-opencode

npm i https://pkg.pr.new/@tanstack/ai-opencode@922

@tanstack/ai-openrouter

npm i https://pkg.pr.new/@tanstack/ai-openrouter@922

@tanstack/ai-preact

npm i https://pkg.pr.new/@tanstack/ai-preact@922

@tanstack/ai-react

npm i https://pkg.pr.new/@tanstack/ai-react@922

@tanstack/ai-react-ui

npm i https://pkg.pr.new/@tanstack/ai-react-ui@922

@tanstack/ai-sandbox

npm i https://pkg.pr.new/@tanstack/ai-sandbox@922

@tanstack/ai-sandbox-cloudflare

npm i https://pkg.pr.new/@tanstack/ai-sandbox-cloudflare@922

@tanstack/ai-sandbox-daytona

npm i https://pkg.pr.new/@tanstack/ai-sandbox-daytona@922

@tanstack/ai-sandbox-docker

npm i https://pkg.pr.new/@tanstack/ai-sandbox-docker@922

@tanstack/ai-sandbox-local-process

npm i https://pkg.pr.new/@tanstack/ai-sandbox-local-process@922

@tanstack/ai-sandbox-sprites

npm i https://pkg.pr.new/@tanstack/ai-sandbox-sprites@922

@tanstack/ai-sandbox-vercel

npm i https://pkg.pr.new/@tanstack/ai-sandbox-vercel@922

@tanstack/ai-solid

npm i https://pkg.pr.new/@tanstack/ai-solid@922

@tanstack/ai-solid-ui

npm i https://pkg.pr.new/@tanstack/ai-solid-ui@922

@tanstack/ai-svelte

npm i https://pkg.pr.new/@tanstack/ai-svelte@922

@tanstack/ai-utils

npm i https://pkg.pr.new/@tanstack/ai-utils@922

@tanstack/ai-vue

npm i https://pkg.pr.new/@tanstack/ai-vue@922

@tanstack/ai-vue-ui

npm i https://pkg.pr.new/@tanstack/ai-vue-ui@922

@tanstack/openai-base

npm i https://pkg.pr.new/@tanstack/openai-base@922

@tanstack/preact-ai-devtools

npm i https://pkg.pr.new/@tanstack/preact-ai-devtools@922

@tanstack/react-ai-devtools

npm i https://pkg.pr.new/@tanstack/react-ai-devtools@922

@tanstack/solid-ai-devtools

npm i https://pkg.pr.new/@tanstack/solid-ai-devtools@922

commit: 1f9a170

@AlemTuzlak AlemTuzlak merged commit e0bbbdd into TanStack:main Jul 9, 2026
10 checks passed
@github-actions github-actions Bot mentioned this pull request Jul 9, 2026
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.

Sweep: fix skipLibCheck-masked dangling .d.ts imports across packages (+ add a guardrail)

2 participants