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

[BUG]: "internal" is not set as a type for Endpoints['POST /orgs/{org}/repos']['parameters']['visibility'] #522

Open
1 task done
ataylorme opened this issue Apr 11, 2023 · 6 comments
Labels
hacktoberfest Issues for participation in Hacktoberfest Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented, or is being fixed

Comments

@ataylorme
Copy link

What happened?

When using Octokit to call the GitHub REST API endpoint POST /orgs/{org}/repos and setting visibility to internal there is a TypeScript error.

The type for Endpoints['POST /orgs/{org}/repos']['parameters']['visibility'] is defined as "private" | "public" and is missing internal.

When calling the GitHub API directly to create a repository in an organization visibility set to internal works as expected.

The TypeScript type does not match the API functionality.

Related: github/docs#24990

Versions

@octokit/core version 4.2.0
@octokit/types version 9.0.0
NodeJS version v18.15.0
TypeScript version 5.0.3

Relevant log output

TS2322: Type '"public" | "internal" | "private"' is not assignable to type '"private" | "public"'.
  Type '"internal"' is not assignable to type '"private" | "public"'.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@ataylorme ataylorme added Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented, or is being fixed labels Apr 11, 2023
@kfcampbell kfcampbell added Status: Up for grabs Issues that are ready to be worked on by anyone Priority: Normal and removed Status: Triage This is being looked at and prioritized labels Apr 12, 2023
@kfcampbell kfcampbell moved this from 🆕 Triage to 🔥 Backlog in 🧰 Octokit Active Apr 12, 2023
@MFpX13cumseeme
Copy link

I’ll get it

@MFpX13cumseeme
Copy link

Source code 2019889603

@ataylorme
Copy link
Author

Actually, it seems internal is documented as valid for Enterprise Cloud (link)

So my question can be reframed as how can I use @octokit/types with types for Enterprise Cloud?

@nickfloyd nickfloyd added the hacktoberfest Issues for participation in Hacktoberfest label Sep 20, 2023
@wolfy1339
Copy link
Member

You will need to use the @octokit/plugin-enterprise-cloud package for access to GHEC endpoints and types.

Unfortunately, there currently isn't a solution for endpoints that are shared between GitHub.com, GHES, and GHEC

There is @octokit-next that is a rewrite of the packages into ESM and has much better GHEC/GHES support built-in, but unfortunately that project is on hold for the moment

@ataylorme
Copy link
Author

Thanks @wolfy1339. The README in the repo doesn't have any example. Can you provide an example of loading those types?

@ataylorme
Copy link
Author

For anyone else who comes across this I was able to get the types from https://github.com/octokit/openapi-types.ts/tree/main/packages/openapi-types-ghec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest Issues for participation in Hacktoberfest Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented, or is being fixed
Projects
Status: 🔥 Backlog
Development

No branches or pull requests

5 participants