Skip to content

fix: separate Next.js types into /next subpath export#137

Merged
sohil-kshirsagar merged 3 commits intomainfrom
fix/separate-nextjs-entry-point
Mar 11, 2026
Merged

fix: separate Next.js types into /next subpath export#137
sohil-kshirsagar merged 3 commits intomainfrom
fix/separate-nextjs-entry-point

Conversation

@sohil-kshirsagar
Copy link
Contributor

Summary

  • Moves withTuskDrift and TuskDriftNextOptions to a new @use-tusk/drift-node-sdk/next subpath export
  • The main entry point (@use-tusk/drift-node-sdk) no longer imports from next, eliminating transitive type errors (@types/react, etc.) for non-Next.js consumers
  • Adds explicit types fields to all subpath exports for proper TypeScript resolution

Problem

The generated dist/index.d.cts had import { NextConfig } from "next" on line 1. Any consumer importing anything from the SDK — even just TuskDrift — would trigger TypeScript to resolve next and transitively react types, causing 187+ type errors in strict configs without skipLibCheck.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 6 files

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@tusk-dev
Copy link

tusk-dev bot commented Mar 11, 2026

Generated 40 tests - 40 passed

Commit tests View tests

Tip

New to Tusk? Learn more here.

Tusk generated some tests - go to the Tusk UI to add tests.

Test Summary

  • getNextjsVersion - 2 ✓
  • parseVersion - 5 ✓
  • shouldSetInstrumentationHook - 18 ✓
  • withTuskDrift - 15 ✓

Results

Tusk's tests all pass cleanly. The test suite validates the core logic for separating Next.js types into a subpath export—specifically parseVersion, shouldSetInstrumentationHook, getNextjsVersion, and withTuskDrift. The high-value tests confirm that version parsing handles stable, prerelease, and canary versions correctly; that instrumentation hooks are gated properly across Next.js 13–15.x; and that withTuskDrift preserves user config while correctly merging serverExternalPackages and webpack externals based on drift mode (RECORD/REPLAY/OFF). Critical path coverage includes version detection fallback behavior, config preservation for existing user settings, and webpack function composition—all essential for preventing type resolution errors in non-Next.js consumers while maintaining backward compatibility for Next.js users.


View check history

Commit Status Output Created (UTC)
9203b40 Skipped due to new commit on branch Output Mar 11, 2026 9:11PM
162a524 Generated 40 tests - 40 passed Tests Mar 11, 2026 9:18PM
3f3bbb4 Generated 40 tests - 40 passed Tests Mar 11, 2026 9:30PM

Was Tusk helpful? Give feedback by reacting with 👍 or 👎

@sohil-kshirsagar sohil-kshirsagar merged commit fde3b9a into main Mar 11, 2026
19 checks passed
@sohil-kshirsagar sohil-kshirsagar deleted the fix/separate-nextjs-entry-point branch March 11, 2026 22:34
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.

2 participants