Skip to content

fix: use workspace TypeScript for Astro tsconfig resolution#711

Open
TeamInfinixdevcom wants to merge 1 commit into
firstcontributions:mainfrom
TeamInfinixdevcom:main
Open

fix: use workspace TypeScript for Astro tsconfig resolution#711
TeamInfinixdevcom wants to merge 1 commit into
firstcontributions:mainfrom
TeamInfinixdevcom:main

Conversation

@TeamInfinixdevcom
Copy link
Copy Markdown

@TeamInfinixdevcom TeamInfinixdevcom commented May 17, 2026

@Sean-Kenneth-Doherty
Thanks for the review — you were right to question the original approach.

Root-Cause Analysis & Resolution

The Issue Was Environment/Editor-Related, Not a Config Bug

The extends: "astro/tsconfigs/strict" reference failed in some editor environments because:

  • Editors were using their own bundled TypeScript (often older versions) that don't properly honor package exports mappings for JSON config files
  • Without a workspace typescript devDependency, there was no consistent TS version for editors to use

Why This Fix Avoids Portability Issues

Rather than hardcoding a relative path to node_modules/astro/tsconfigs/strict.json, we added typescript as a workspace devDependency. This approach:

  • Leverages official Astro conventions (package exports are the recommended approach)
  • Ensures editors, CI, and contributors all use the same TypeScript version
  • Remains portable across package managers (npm, pnpm, yarn) without coupling to node_modules layout
  • Reduces future maintenance burden (no path rewrites if Astro reorganizes internals)

Astro Recommendation Preserved

The config now follows Astro's published best practice: projects should use workspace TypeScript that understands package exports. This is more robust than relative path workarounds.

Verification

  • pnpm build succeeds
  • pnpm exec tsc --showConfig properly resolves merged config (strict mode + JSX settings)

Changes

  • Added typescript: ^5.9 as workspace devDependency
  • Updated lock file accordingly

- Add typescript as a workspace devDependency
- Ensures editors and CI use workspace TypeScript for proper package
  exports resolution (e.g., astro/tsconfigs/strict)
- Preserves official Astro convention (extends: 'astro/tsconfigs/strict')
- Avoids brittle workarounds that hardcode node_modules paths
- Verified: npm run build and tsc --showConfig resolve correctly
Copilot AI review requested due to automatic review settings May 17, 2026 19:15
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a workspace-level typescript devDependency so editor/CI TypeScript consistently resolves Astro’s exported astro/tsconfigs/strict config, avoiding failures caused by editors using bundled/older TS versions that don’t fully honor package exports for JSON configs.

Changes:

  • Add typescript: ^5.9 to root devDependencies.
  • Update pnpm-lock.yaml to lock TypeScript (5.9.3) and reflect the updated peer resolution for Astro and related packages.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.

File Description
package.json Adds workspace typescript devDependency to standardize TS used by editors/CI.
pnpm-lock.yaml Locks typescript@5.9.3 and updates dependency graph/metadata accordingly.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Author

@TeamInfinixdevcom TeamInfinixdevcom left a comment

Choose a reason for hiding this comment

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

concluid

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