-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Add a TypeScript step to create-astro
#4179
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'create-astro': minor | ||
--- | ||
|
||
Add a step to configure how strict TypeScript should be |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"compilerOptions": { | ||
// Enable top-level await, and other modern ESM features. | ||
"target": "ESNext", | ||
"module": "ESNext", | ||
// Enable node-style module resolution, for things like npm package imports. | ||
"moduleResolution": "node", | ||
// Enable JSON imports. | ||
"resolveJsonModule": true, | ||
// Enable stricter transpilation for better output. | ||
"isolatedModules": true, | ||
// Astro will directly run your TypeScript code, no transpilation needed. | ||
"noEmit": true, | ||
// Enable strict type checking. | ||
"strict": true, | ||
// Error when a value import is only used as a type. | ||
"importsNotUsedAsValues": "error" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"compilerOptions": { | ||
// Enable top-level await, and other modern ESM features. | ||
"target": "ESNext", | ||
"module": "ESNext", | ||
// Enable node-style module resolution, for things like npm package imports. | ||
"moduleResolution": "node", | ||
// Enable JSON imports. | ||
"resolveJsonModule": true, | ||
// Enable stricter transpilation for better output. | ||
"isolatedModules": true, | ||
// Astro will directly run your TypeScript code, no transpilation needed. | ||
"noEmit": true, | ||
// Enable strict type checking. | ||
"strict": true, | ||
// Error when a value import is only used as a type. | ||
"importsNotUsedAsValues": "error", | ||
// Report errors for fallthrough cases in switch statements | ||
"noFallthroughCasesInSwitch": true, | ||
// Force functions designed to override their parent class to be specified as `override`. | ||
"noImplicitOverride": true, | ||
// Force functions to specify that they can return `undefined` if a possibe code path does not return a value. | ||
"noImplicitReturns": true, | ||
// Report an error when a variable is declared but never used. | ||
"noUnusedLocals": true, | ||
// Report an error when a parameter is declared but never used. | ||
"noUnusedParameters": true, | ||
// Force the usage of the indexed syntax to access fields declared using an index signature. | ||
"noUncheckedIndexedAccess": true, | ||
// Report an error when the value `undefined` is given to an optional property that doesn't specify `undefined` as a valid value. | ||
"exactOptionalPropertyTypes": true | ||
} | ||
} |
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.
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 LOVE this option! This is such user empathy! 😄
I would suggest adjusting the message a little bit, though. When I read it, I read "kind" expecting "kind of..." So, I thought it was going to say, "We'll keep this kind of...." and then it stopped.
Often designing messages for the widest audience possible, we would try to avoid slang etc. So, you can't go wrong with a very factual description here of what will/won't happen. But, I think if you want to convey this friendliness, there are still some choices that could work. Maybe like....
First part: I think "No worries" is much more common across an international audience than "No issues" (issues might make people think of bugs? or is there an "issue" with this process?) I'd consider "worries" instead.
Second part: this is a little harder, but here are some possibilities that might be a bit more accessible while still being fun, maybe?
... ?
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 agree! I used
No issues
becauseNo worries
is used earlier in the steps and my brain immediately went in "Find synonyms" mode 😄For the second part, we can't say that the user won't have to use it or that it'll disable anything because it effectively doesn't. TypeScript is always enabled, just with friendlier settings.
we'll keep things casual
seems good to me!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.
Here were my suggestions, lmk what you think! #4179 (comment)
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.
One thought on formatting: because this is the last question, what if the "don't love typescript" message came after "setup complete!" That way it wouldn't break up the series of prompts mid-way through.