Skip to content
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: Add optional to type chain #560

Merged
merged 2 commits into from
Oct 28, 2024
Merged

fix: Add optional to type chain #560

merged 2 commits into from
Oct 28, 2024

Conversation

brian-lou
Copy link
Member

This PR fixes #559

Copy link
Member

@asottile-sentry asottile-sentry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should probably also include a test -- here's the actual api body for the PR which may be helpful in crafting a fake graphql response for a test https://api.github.com/repos/getsentry/jsonnet-libs/pulls/5

@@ -472,7 +472,7 @@ async function getPRAndMilestoneFromCommit(
hash.slice(1),
pr
? {
author: pr.author.login,
author: pr.author?.login ?? null,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think ?? null is needed here with the ?. access (since that'll become undefined already) -- I think this also needs a fix to the types above because as it is right now the ?. looks unnecessary (I'm surprised the type checker isn't complaining about this?)

Copy link
Member

@asottile-sentry asottile-sentry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add the additional context to the issue as requested on slack -- looks good and thanks for the test! (helps to show that this makes a reasonable output too!)

@brian-lou brian-lou merged commit 0386937 into master Oct 28, 2024
10 checks passed
@brian-lou brian-lou deleted the brian/fix-null-bug branch October 28, 2024 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug caused by missing PR Author
2 participants