Skip to content

Conversation

@maxisch
Copy link
Contributor

@maxisch maxisch commented Aug 3, 2025

Description

This PR implements TypeScript project references to fix Cursor IDE navigation issues where "Go to Definition" was navigating to .d.ts declaration files instead of TypeScript source files when navigating between packages in the monorepo.

The solution establishes proper cross-module relationships by:

  • Adding references arrays to all package tsconfig.json files pointing to their workspace dependencies
  • Creating a root tsconfig.json with references to all packages in the monorepo
  • Updating the VS Code workspace configuration with TypeScript-specific IDE settings

This replaces the previous approach of generating declaration maps via tsup callbacks, which was insufficient for cross-module navigation. TypeScript project references are the recommended solution according to the official TypeScript documentation for enabling "transparent goto definition" across project boundaries in monorepos.

Key Implementation Note: The initial implementation included composite: true in all tsconfig files (as recommended by TypeScript docs), but this had to be removed due to build compatibility issues with the tsup build system where files in subdirectories weren't being recognized properly.

Test plan

⚠️ Critical Testing Gap: The core functionality (Cursor IDE cross-module navigation) has not been tested yet and requires manual verification.

Completed Testing:

  • pnpm build:libs passes with all packages building successfully
  • pnpm lint:fix resolves formatting issues in tsconfig files
  • ✅ All TypeScript project references are syntactically correct

Required Manual Testing:

  • Test cross-module navigation in Cursor IDE: Open a file that imports from another workspace package (e.g., packages/client/react-base/src/providers/CrossmintProvider.tsx line 2) and use "Go to Definition" on the import to verify navigation goes to source files instead of .d.ts files
  • Verify navigation works across multiple package dependency chains
  • Test with different types of imports (named exports, default exports, type imports)

Package updates

No package.json changes were made - this is purely a TypeScript configuration change.


Human Review Checklist

High Priority:

  1. Test the actual IDE navigation behavior - this is the core requirement that cannot be automated
  2. Verify dependency mapping accuracy - check that all references arrays correctly reflect the actual workspace dependencies in package.json files
  3. Assess impact of missing composite: true - determine if the solution is effective without composite mode

Medium Priority:
4. Check that no packages are missing from the root tsconfig.json references
5. Verify build system stability with the new configuration
6. Test that existing development workflows (hot reload, etc.) still work properly

Notes:

  • This approach follows TypeScript's official project references documentation
  • The absence of composite: true is a compromise due to build system constraints and may affect effectiveness
  • Manual IDE testing is essential since this cannot be automated

Link to Devin run: https://app.devin.ai/sessions/c019a46789184dcfa032cd93b5e23f75
Requested by: @maxisch

- Add onSuccess callback to tsup base config to generate .d.ts.map files
- Fixes Cursor navigation going to .d.ts instead of source files
- Uses tsc --emitDeclarationOnly --declarationMap as recommended by tsup docs
- Includes || true to allow build to continue even if some packages have compilation errors

Co-Authored-By: max@paella.dev <maximiliano.schultheis@gmail.com>
@devin-ai-integration
Copy link
Contributor

Original prompt from max@paella.dev
when using cursor, file navigation is broken. It goes to the .d.ts files instead of the source file. Can you fix this?


You only need to look in the following repo: Crossmint/crossmint-sdk

@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@changeset-bot
Copy link

changeset-bot bot commented Aug 3, 2025

⚠️ No Changeset found

Latest commit: 00a5435

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Aug 3, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
smart-wallet-auth-demo ⬜️ Ignored (Inspect) Aug 3, 2025 3:18am

…tion

- Add TypeScript project references to all package tsconfig.json files
- Create root tsconfig.json with references to all packages
- Update workspace configuration with TypeScript IDE settings
- Remove composite mode to resolve build compatibility issues
- Enable proper cross-module source navigation in Cursor IDE

This replaces the previous declaration maps approach with TypeScript
project references, which is the recommended solution for monorepo
cross-module navigation according to TypeScript documentation.

Co-Authored-By: max@paella.dev <maximiliano.schultheis@gmail.com>
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