-
Notifications
You must be signed in to change notification settings - Fork 391
fix: actually populate auth user
field
#7181
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
We were reading from the wrong property.
src/utils/gh-auth.ts
Outdated
|
||
const { authMethod } = await inquirer.prompt([ | ||
const { authMethod } = (await inquirer.prompt([ |
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.
Didn't notice this before, but prompt accepts a generic:
const { authMethod } = (await inquirer.prompt([ | |
const { authMethod } = (await inquirer.prompt<{ authMethod: typeof authChoices[number] }>([ |
I don't think this is any more safe, but at least lets you avoid the assertion? 🤷
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.
Weird, I believe I'd tried that and couldn't get it working, but it's working fine now. I've just refactored all the inquirer.prompt type assertions. 👍🏼
src/utils/gh-auth.ts
Outdated
@@ -32,7 +32,7 @@ const promptForAuthMethod = async () => { | |||
'What would you like to do?', | |||
choices: authChoices, | |||
}, | |||
]) | |||
])) as { authMethod: typeof authChoices[number] } |
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.
])) as { authMethod: typeof authChoices[number] } | |
])) |
Summary
The types fixes in #7130 identified a number of bugs. This fixes one of those. We were reading from the wrong property on the GitHub API response.