You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constoctokit=newOctokit()constresponse=awaitoctokit.request('GET /repos/{owner}/{repo}',{owner: '',repo: '',})if(response.status===404){// <= Typescript error: TS2367: This condition will always return 'false' since the types '200' and '404' have no overlap.thrownewError('Repo not found')}
What did you expect to happen?
@octokit/openapi-types already defines different responses codes including 404:
/** The `parent` and `source` objects are present when the repository is a fork. `parent` is the repository this repository was forked from, `source` is the ultimate source for the network. */"repos/get": {
parameters: {
path: {/** The account owner of the repository. The name is not case sensitive. */
owner: components["parameters"]["owner"];/** The name of the repository. The name is not case sensitive. */
repo: components["parameters"]["repo"];};};
responses: {/** Response */200: {content: {"application/json": components["schemas"]["full-repository"];};};301: components["responses"]["moved_permanently"];403: components["responses"]["forbidden"];404: components["responses"]["not_found"];};};
So I expect response.status type should be 200 | 301 | 403 | 404
What the problem might be
Maybe because Endpoints.ExtractOctokitResponse doesn't handle error response codes?
What happened?
Typescript 4.7.4
Minimal reproducible code:
What did you expect to happen?
@octokit/openapi-types
already defines different responses codes including 404:So I expect
response.status
type should be200 | 301 | 403 | 404
What the problem might be
Maybe because Endpoints.ExtractOctokitResponse doesn't handle error response codes?
The text was updated successfully, but these errors were encountered: