fix: use workspace TypeScript for Astro tsconfig resolution#711
Open
TeamInfinixdevcom wants to merge 1 commit into
Open
fix: use workspace TypeScript for Astro tsconfig resolution#711TeamInfinixdevcom wants to merge 1 commit into
TeamInfinixdevcom wants to merge 1 commit into
Conversation
- 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
There was a problem hiding this comment.
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.9to rootdevDependencies. - Update
pnpm-lock.yamlto 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@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:exportsmappings for JSON config filestypescriptdevDependency, there was no consistent TS version for editors to useWhy This Fix Avoids Portability Issues
Rather than hardcoding a relative path to
node_modules/astro/tsconfigs/strict.json, we addedtypescriptas a workspace devDependency. This approach:node_moduleslayoutAstro 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 buildsucceedspnpm exec tsc --showConfigproperly resolves merged config (strict mode + JSX settings)Changes
typescript: ^5.9as workspace devDependency