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

@octokit/types is no longer available after 4.0.0 #2683

Closed
mjfwebb opened this issue May 15, 2024 · 13 comments
Closed

@octokit/types is no longer available after 4.0.0 #2683

mjfwebb opened this issue May 15, 2024 · 13 comments
Labels
Type: Support Any questions, information, or general needs around the SDK or GitHub APIs

Comments

@mjfwebb
Copy link

mjfwebb commented May 15, 2024

@octokit/types is no longer available for me after 4.0.0, I get this error: Cannot find module '@octokit' or its corresponding type declarations.

Some relevant information, as it seems the types directory is missing in 4.0.0:

The node_modules/@oktokit contents on 3.1.0:

$ ls
app/                   graphql/                       plugin-throttling/
auth-app/              oauth-app/                     request/
auth-oauth-app/        oauth-authorization-url/       request-error/
auth-oauth-device/     oauth-methods/                 types/
auth-oauth-user/       openapi-types/                 webhooks/
auth-token/            plugin-paginate-graphql/       webhooks-methods/
auth-unauthenticated/  plugin-paginate-rest/          webhooks-types/
core/                  plugin-rest-endpoint-methods/
endpoint/              plugin-retry/

The node_modules/@octokit contents after 4.0.0:

$ ls
app/             auth-oauth-device/     oauth-app/                openapi-webhooks-types/
auth-app/        auth-oauth-user/       oauth-authorization-url/  webhooks/
auth-oauth-app/  auth-unauthenticated/  oauth-methods/            webhooks-methods/

My package.json entries between upgrading to 4.0.0 (most lines have been removed for the sake of brevity):

Before:

  "type": "module",
  "dependencies": {
    "octokit": "^3.1.0",
  },

After:

  "type": "module",
  "dependencies": {
    "octokit": "^4.0.0",
  },

tsconfig.json is using the node16 for module/moduleResolution.

I've made a small reproduction showing this issue: https://codesandbox.io/p/devbox/4wls6z?file=%2Fsrc%2Findex.ts%3A13%2C1

Originally posted by @mjfwebb in #2598 (comment)

Copy link

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

@wolfy1339
Copy link
Member

I can't seem to access your codesandbox

@mjfwebb
Copy link
Author

mjfwebb commented May 15, 2024

I can't seem to access your codesandbox

Apologies. I've made it public now.

@mjfwebb
Copy link
Author

mjfwebb commented May 15, 2024

@wolfy1339 I realised I wrote the wrong import, it's updated now to import type { Endpoints } from "@octokit/types"; and shows the issue properly still

@wolfy1339
Copy link
Member

This seems like it's an issue with pnpm and TypeScript.

When using npm the types work just fine

@gr2m
Copy link
Contributor

gr2m commented May 15, 2024

it's probably in a subfolder. What do you get when you run npm ls @octokit/types

@mjfwebb
Copy link
Author

mjfwebb commented May 15, 2024

npm ls @octokit/types

└─┬ octokit@4.0.1
  ├─┬ @octokit/app@15.0.1
  │ ├─┬ @octokit/auth-app@7.0.0
  │ │ ├─┬ @octokit/request-error@6.1.1
  │ │ │ └── @octokit/types@13.5.0 deduped
  │ │ ├─┬ @octokit/request@9.1.1
  │ │ │ ├─┬ @octokit/endpoint@10.1.1
  │ │ │ │ └── @octokit/types@13.5.0 deduped
  │ │ │ └── @octokit/types@13.5.0 deduped
  │ │ └── @octokit/types@13.5.0
  │ ├─┬ @octokit/auth-unauthenticated@6.1.0
  │ │ ├─┬ @octokit/request-error@6.1.1
  │ │ │ └── @octokit/types@13.5.0 deduped
  │ │ └── @octokit/types@13.5.0
  │ ├─┬ @octokit/core@6.1.2
  │ │ ├─┬ @octokit/graphql@8.1.1
  │ │ │ └── @octokit/types@13.5.0 deduped
  │ │ ├─┬ @octokit/request-error@6.1.1
  │ │ │ └── @octokit/types@13.5.0 deduped
  │ │ ├─┬ @octokit/request@9.1.1
  │ │ │ ├─┬ @octokit/endpoint@10.1.1
  │ │ │ │ └── @octokit/types@13.5.0 deduped
  │ │ │ └── @octokit/types@13.5.0 deduped
  │ │ └── @octokit/types@13.5.0 deduped
  │ ├─┬ @octokit/plugin-paginate-rest@11.3.0
  │ │ └── @octokit/types@13.5.0 deduped
  │ ├── @octokit/types@13.5.0
  │ └─┬ @octokit/webhooks@13.2.7
  │   └─┬ @octokit/request-error@6.1.1
  │     └── @octokit/types@13.5.0
  ├─┬ @octokit/core@6.1.2
  │ ├─┬ @octokit/graphql@8.1.1
  │ │ └── @octokit/types@13.5.0 deduped
  │ ├─┬ @octokit/request@9.1.1
  │ │ ├─┬ @octokit/endpoint@10.1.1
  │ │ │ └── @octokit/types@13.5.0 deduped
  │ │ └── @octokit/types@13.5.0 deduped
  │ └── @octokit/types@13.5.0 deduped
  ├─┬ @octokit/oauth-app@7.1.2
  │ ├─┬ @octokit/auth-oauth-app@8.1.1
  │ │ ├─┬ @octokit/auth-oauth-device@7.1.1
  │ │ │ ├─┬ @octokit/request@9.1.1
  │ │ │ │ ├─┬ @octokit/endpoint@10.1.1
  │ │ │ │ │ └── @octokit/types@13.5.0 deduped
  │ │ │ │ ├─┬ @octokit/request-error@6.1.1
  │ │ │ │ │ └── @octokit/types@13.5.0 deduped
  │ │ │ │ └── @octokit/types@13.5.0 deduped
  │ │ │ └── @octokit/types@13.5.0
  │ │ ├─┬ @octokit/request@9.1.1
  │ │ │ ├─┬ @octokit/endpoint@10.1.1
  │ │ │ │ └── @octokit/types@13.5.0 deduped
  │ │ │ ├─┬ @octokit/request-error@6.1.1
  │ │ │ │ └── @octokit/types@13.5.0 deduped
  │ │ │ └── @octokit/types@13.5.0 deduped
  │ │ └── @octokit/types@13.5.0
  │ ├─┬ @octokit/auth-oauth-user@5.1.1
  │ │ ├─┬ @octokit/request@9.1.1
  │ │ │ ├─┬ @octokit/endpoint@10.1.1
  │ │ │ │ └── @octokit/types@13.5.0 deduped
  │ │ │ ├─┬ @octokit/request-error@6.1.1
  │ │ │ │ └── @octokit/types@13.5.0 deduped
  │ │ │ └── @octokit/types@13.5.0 deduped
  │ │ └── @octokit/types@13.5.0
  │ ├─┬ @octokit/core@6.1.2
  │ │ ├─┬ @octokit/graphql@8.1.1
  │ │ │ └── @octokit/types@13.5.0 deduped
  │ │ ├─┬ @octokit/request-error@6.1.1
  │ │ │ └── @octokit/types@13.5.0 deduped
  │ │ ├─┬ @octokit/request@9.1.1
  │ │ │ ├─┬ @octokit/endpoint@10.1.1
  │ │ │ │ └── @octokit/types@13.5.0 deduped
  │ │ │ └── @octokit/types@13.5.0 deduped
  │ │ └── @octokit/types@13.5.0
  │ └─┬ @octokit/oauth-methods@5.1.2
  │   ├─┬ @octokit/request-error@6.1.1
  │   │ └── @octokit/types@13.5.0 deduped
  │   ├─┬ @octokit/request@9.1.1
  │   │ ├─┬ @octokit/endpoint@10.1.1
  │   │ │ └── @octokit/types@13.5.0 deduped
  │   │ └── @octokit/types@13.5.0 deduped
  │   └── @octokit/types@13.5.0
  ├─┬ @octokit/plugin-paginate-rest@11.3.0
  │ └── @octokit/types@13.5.0 deduped
  ├─┬ @octokit/plugin-rest-endpoint-methods@13.2.1
  │ └── @octokit/types@13.5.0 deduped
  ├─┬ @octokit/plugin-retry@7.1.1
  │ └── @octokit/types@13.5.0 deduped
  ├─┬ @octokit/plugin-throttling@9.3.0
  │ └── @octokit/types@13.5.0 deduped
  ├─┬ @octokit/request-error@6.1.1
  │ └── @octokit/types@13.5.0 deduped
  └── @octokit/types@13.5.0

@mjfwebb
Copy link
Author

mjfwebb commented May 15, 2024

This seems like it's an issue with pnpm and TypeScript.

When using npm the types work just fine

I'm using npm locally. I think that's a red herring because codesandbox defaulted to using pnpm

@gr2m
Copy link
Contributor

gr2m commented May 15, 2024

I don't have much experience with pnpm, but I don't think the issue you filed is valid. If you want I'd suggest to create a follow up one with reproducible steps using pnpm. But I suggest we close this one

@wolfy1339
Copy link
Member

wolfy1339 commented May 15, 2024

If you want to use @octokit/types you need to add it as a dependency to your project when using pnpm
https://www.reddit.com/r/typescript/comments/h043pc/comment/ftkekt1/

Anyways, it's always a good idea to have it as a dependency if you are going to interact with it directly in your code

@mjfwebb
Copy link
Author

mjfwebb commented May 15, 2024

@gr2m @wolfy1339 not sure if you missed my earlier reply, but I'm not using pnpm locally. It was the default of codesandbox.

Edit: I was able to get it working on codesandbox with npm however, so I'm trying to narrow down the differences in tsconfig.

@wolfy1339
Copy link
Member

Yes, I saw your comment. My comment explains why it wasn't working with pnpm, and the tidbit i shared is valid for both npm and pnpm

@mjfwebb
Copy link
Author

mjfwebb commented May 15, 2024

I think that's a perfect solution @wolfy1339. It works fine for me to set @octokit/types as a dependency.

Thanks very much for your help.

@mjfwebb mjfwebb closed this as completed May 15, 2024
@wolfy1339 wolfy1339 added the Type: Support Any questions, information, or general needs around the SDK or GitHub APIs label May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Support Any questions, information, or general needs around the SDK or GitHub APIs
Projects
Archived in project
Development

No branches or pull requests

3 participants