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: adapt for latest @octokit/types #66

Merged
merged 4 commits into from
Jan 15, 2021
Merged

fix: adapt for latest @octokit/types #66

merged 4 commits into from
Jan 15, 2021

Conversation

jetersen
Copy link
Contributor

@jetersen jetersen commented Jan 14, 2021

Package-lock had locked @octokit/types to version 5.x.x...

fixes #65

owner,
repo,
});
const hasFork = forks.data.find(
(fork) => fork.owner.login === user.data.login
(fork) => fork!.owner!.login === user.data.login
Copy link
Contributor Author

@jetersen jetersen Jan 14, 2021

Choose a reason for hiding this comment

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

Not sure what the right approach is since if you use fork?.owner?.login code coverage decreases.

Copy link
Owner

Choose a reason for hiding this comment

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

The first exclamation mark is unnecessary. I'm not sure how a fork can get into a state where fork.owner can be null but I guess there is one. I'd change the code above to

Suggested change
(fork) => fork!.owner!.login === user.data.login
/* istanbul ignore next - fork owner can be null, but we don't test that */
(fork) => fork.owner?.login === user.data.login

Alternatively we could add a test for the case when fork.owner is null, but I don't think it's worth it

Copy link
Owner

@gr2m gr2m left a comment

Choose a reason for hiding this comment

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

This is great! I left two suggestions to bring bring it over the finish line :)

owner,
repo,
});
const hasFork = forks.data.find(
(fork) => fork.owner.login === user.data.login
(fork) => fork!.owner!.login === user.data.login
Copy link
Owner

Choose a reason for hiding this comment

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

The first exclamation mark is unnecessary. I'm not sure how a fork can get into a state where fork.owner can be null but I guess there is one. I'd change the code above to

Suggested change
(fork) => fork!.owner!.login === user.data.login
/* istanbul ignore next - fork owner can be null, but we don't test that */
(fork) => fork.owner?.login === user.data.login

Alternatively we could add a test for the case when fork.owner is null, but I don't think it's worth it

owner,
repo,
sha: base,
per_page: 1,
});
state.latestCommitSha = latestCommit.sha;
state.latestCommitSha = latestCommit.sha as string;
Copy link
Owner

Choose a reason for hiding this comment

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

Can you update package-lock.json so that @octokit/types 6.3.0+ is used? Then you can remove the as string

Suggested change
state.latestCommitSha = latestCommit.sha as string;
state.latestCommitSha = latestCommit.sha;

Comment on lines 2 to +4
import type { Endpoints } from "@octokit/types";

export type TreeParameter = Endpoints["POST /repos/:owner/:repo/git/trees"]["parameters"]["tree"];
export type TreeParameter = Endpoints["POST /repos/{owner}/{repo}/git/trees"]["parameters"]["tree"];
Copy link
Owner

Choose a reason for hiding this comment

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

I think we should add @octokit/types as a direct dependency of this package, as we use it in the code, that will make it more predictable. And I've seen yarn users having problems when using sub-dependencies

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will do!

Copy link
Owner

@gr2m gr2m left a comment

Choose a reason for hiding this comment

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

Mange tak!

@gr2m gr2m changed the title fix octokit types fix: adapt for latest @octokit/types Jan 15, 2021
@gr2m gr2m merged commit f2abf7f into gr2m:main Jan 15, 2021
@github-actions
Copy link

🎉 This PR is included in version 3.9.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@jetersen
Copy link
Contributor Author

Selv tak!

@jetersen jetersen deleted the fix/types branch January 15, 2021 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

broken types in newer version of octokit types
2 participants