-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for updating tsconfig.json when using astro add #4959
Conversation
🦋 Changeset detectedLatest commit: bf9acd1 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is blocked because it contains a minor
changeset. A reviewer will merge this at the next release if approved.
"react-dom": "^17.0.2 || ^18.0.0", | ||
"@types/react": "^17.0.50 || ^18.0.21" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated, but those two were missing and are necessary for using React with TypeScript
Putting this back into WIP because I realized there's a major issue with how the configs are merged when using complex tsconfigs |
b7760e8
to
ba72072
Compare
typeof (globalThis as any).AggregateError !== 'undefined' | ||
? (globalThis as any).AggregateError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the type-fest
upgrade made this fail. I suspect we were depending on it by accident, weird
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is not accidental, we create AggregateErrors when there are multiple CSS errors during compilation. AggregateError is being polyfilled here as its not available in certain Node versions.
But I guess it's possible that type-fest
was shimming the types for it, which is why we weren't getting an error before.
Fixes #5017 |
const updateTSConfigResult = await updateTSConfig(cwd, logging, integrations, flags); | ||
|
||
switch (updateTSConfigResult) { | ||
case UpdateResult.none: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
love it
Alternatively, you can use a per-file pragma to set this option, like this : /** @jsxImportSource solid-js */
import type { Component } from 'solid-js'; |
'astro': minor | ||
--- | ||
|
||
Added support for updating TypeScript settings automatically when using `astro add` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind expanding this description a bit more into like a paragraph so it can be copy/pasted into a release blog post? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, let me do that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is blocked because it contains a minor
changeset. A reviewer will merge this at the next release if approved.
Appeared again after rebasing
Changes
This adds a step at the end of
astro add
where it updates yourtsconfig.json
orjsconfig.json
:It handles installing multiple frameworks by choosing the first framework and showing a warning with a link to our docs:
And a specific message for Vue until Volar 1.0 is out and fix this issue:
Fix #4506, Fix #5017
Testing
Added tests for underlying tsconfig loading / manipulation logic.
astro add
itself is untested at the momentDocs
N/A, I think? Will consult docs team