-
Notifications
You must be signed in to change notification settings - Fork 67
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
fix: fix modular ux and bugs #1738
fix: fix modular ux and bugs #1738
Conversation
🦋 Changeset detectedLatest commit: 957bbab The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
a265bb2
to
14e5038
Compare
4d83eeb
to
5662949
Compare
5662949
to
957bbab
Compare
name: string | void; | ||
type: string | void; |
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.
What's the benefit of using string | void
instead of optionality (?
) ?
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.
Good question. I think the difference is that the field must be present in the object, but can have an undefined value, rather than simply being missing from the object entirely.
If there's a benefit there, it's marginal. I copied the pattern that was already used rather than changing it though.
name: 'name', | ||
type: 'text', | ||
message: `What would you like to name this package?`, | ||
})) as { name: string } | Record<string, never>); |
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.
Why the Record<string, never>
?
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.
If the user cancels the prompt with Ctrl+C
, we get an empty object back, literally just {}
. I've used Record<string, never>
to represent that empty object and allow us to check if (!response.name)
on line 44, covering both the case where the user enters no name by pressing enter or cancels by pressing Ctrl+C
.
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.
lgtm
No description provided.