Open lumaxis opened 2 years ago
Thanks for bringing this up!
It's odd that our tests didn't raise this issue earlier.
Would you like to send in a PR to fix the issue?
@wolfy1339 Sure, happy to! I'm just not quite sure if what I suggested is the proper correct fix – or rather: Why does this break in the first place? It seems to only fail in this one file but not in others that use a similar pattern 🤔
It seems to use those types from the @types/node-fetch
package
Adding an explicit import should fix the problem
It seems to only fail in this one file but not in others that use a similar pattern.
Only middleware/cloudflare/*
relies on Request/Response
types.
I’m not sure importing types from @types/node-fetch
is our best option. TypeScript includes a default set of type definitions for built-in JS APIs. Request
type is included in both "DOM" and "WebWorker", the prior one is included by default (when there is no explicit compilerOptions.lib
field in tsconfig.json
).
Without the DOM
lib, handle-request.ts
should also raise errors since it relies on URL
.
I’m not sure what does your compilerOptions.lib
look like. Please let me know if this repo does needs a fix.
yeah these are tricky if we want universal code. I set fetch
to any because I ran into problems such as this:
https://github.com/octokit/types.ts/blob/master/src/Fetch.ts
Since we switched to using native fetch, is there anything we can do for this issue?
Typescript now has the types for Fetch included for NodeJS in the global scope. Request
and Response
are defined.
I think #249 might have introduced an issue in the generated types of this package. When using the package in a project that uses TypeScript (versione 4.3.5), I get the following errors after updating to the latest version of
@octokit/oauth-app
:I guess the
Request
andResponse
types need to be explicitly imported?