octokit.js: Error: Cannot find module '@octokit/rest' or its corresponding type declarations.

Checklist

Environment

  • Node.js 12.18

Versions

├─┬ @octokit/rest@18.0.0
│ ├─┬ @octokit/core@3.1.0
│ │ ├─┬ @octokit/auth-token@2.4.2
│ │ ├─┬ @octokit/graphql@4.5.1
│ │ ├─┬ @octokit/request@5.4.5
│ │ │ ├─┬ @octokit/endpoint@6.0.3
│ │ │ ├─┬ @octokit/request-error@2.0.2
│ │ ├─┬ @octokit/types@5.0.1
│ ├─┬ @octokit/plugin-paginate-rest@2.2.3
│ ├── @octokit/plugin-request-log@1.0.0
│ └─┬ @octokit/plugin-rest-endpoint-methods@4.0.0

What happened?

the types are missing or not discoverable by typescript (v3.9.6)

image

Minimal test case to reproduce the problem

https://github.com/sw-yx/sw-yx/blob/f6a2a5f7b0f654384c402645217896cd8573247c/scrape.ts#L1

What did you expect to happen?

the types should just work

What the problem might be

i’m honestly not sure. the @octokit/rest package.json file points types accordingly to "dist-types/index.d.ts" and the file is there so i dont know why this doesnt work but it doesn’t 😦

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 15 (6 by maintainers)

Most upvoted comments

i got the same conclusion as you. i think this miiiight be a typescript bug. reporting to orta

i think its a bug. according to this https://www.typescriptlang.org/docs/handbook/module-resolution.html#module-resolution-strategies moduleResolution should be node when module is esnext