Fix Cursor IDE navigation to source files instead of .d.ts files#1329
Fix Cursor IDE navigation to source files instead of .d.ts files#1329
Conversation
- 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>
Original prompt from max@paella.dev |
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
…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>
Description
This PR implements TypeScript project references to fix Cursor IDE navigation issues where "Go to Definition" was navigating to
.d.tsdeclaration files instead of TypeScript source files when navigating between packages in the monorepo.The solution establishes proper cross-module relationships by:
referencesarrays to all packagetsconfig.jsonfiles pointing to their workspace dependenciestsconfig.jsonwith references to all packages in the monorepoThis 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: truein 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
Completed Testing:
pnpm build:libspasses with all packages building successfullypnpm lint:fixresolves formatting issues in tsconfig filesRequired Manual Testing:
packages/client/react-base/src/providers/CrossmintProvider.tsxline 2) and use "Go to Definition" on the import to verify navigation goes to source files instead of.d.tsfilesPackage updates
No package.json changes were made - this is purely a TypeScript configuration change.
Human Review Checklist
High Priority:
referencesarrays correctly reflect the actual workspace dependencies in package.json filescomposite: true- determine if the solution is effective without composite modeMedium Priority:
4. Check that no packages are missing from the root
tsconfig.jsonreferences5. Verify build system stability with the new configuration
6. Test that existing development workflows (hot reload, etc.) still work properly
Notes:
composite: trueis a compromise due to build system constraints and may affect effectivenessLink to Devin run: https://app.devin.ai/sessions/c019a46789184dcfa032cd93b5e23f75
Requested by: @maxisch