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]: inferred web middleware type depends on import("undici-types") #1118

Closed
1 task done
Renegade334 opened this issue Feb 24, 2025 · 3 comments · Fixed by #1119
Closed
1 task done

[BUG]: inferred web middleware type depends on import("undici-types") #1118

Renegade334 opened this issue Feb 24, 2025 · 3 comments · Fixed by #1119
Labels
released Type: Bug Something isn't working as documented, or is being fixed

Comments

@Renegade334
Copy link
Contributor

What happened?

@octokit/webhooks v13.7.x (ie. versions featuring #1078) features the following emitted type pattern in dist-types/middleware/web/index.d.ts:

export declare function createWebMiddleware(webhooks: Webhooks, { path, log, }?: MiddlewareOptions): (request: Request) => Promise<import("undici-types").Response>;

The middleware return type is not specified in the source, and is inferred as Promise<import("undici-types").Response> rather than Promise<Response> for the declaration emit, via @types/node's fetch types.

Since undici-types is not a dependency of the octokit packages, this leads to the following TypeScript compilation error, depending on build environment:

error TS2307: Cannot find module 'undici-types' or its corresponding type declarations.

It looks like this has bricked a number of GitHub Actions workflows.

Versions

@octokit/webhooks v13.7.x

Relevant log output

Code of Conduct

  • I agree to follow this project's Code of Conduct
@Renegade334 Renegade334 added Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented, or is being fixed labels Feb 24, 2025
Copy link
Contributor

👋 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 labeled 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

wolfy1339 commented Feb 24, 2025

Thanks for the report, I swear that sometimes Typescript infers types out of nowhere.

Feel free to send a PR. It would be the quickest way to get it fixed

@wolfy1339 wolfy1339 moved this from 🆕 Triage to 🔥 Backlog in 🧰 Octokit Active Feb 24, 2025
@wolfy1339 wolfy1339 removed the Status: Triage This is being looked at and prioritized label Feb 24, 2025
@github-project-automation github-project-automation bot moved this from 🔥 Backlog to ✅ Done in 🧰 Octokit Active Feb 24, 2025
Copy link
Contributor

🎉 This issue has been resolved in version 13.7.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Type: Bug Something isn't working as documented, or is being fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants