[MAINT]: TypeScript Compilation error
ishaan812 opened this issue · comments
Describe the need
Typescript not compiling due to missing interface/types
SDK Version
No response
API Version
"octokit": "^2.0.19"
Relevant log output
node_modules/@octokit/oauth-app/dist-types/middleware/web-worker/index.d.ts:5:36 - error TS2304: Cannot find name 'Request'.
5 onUnhandledRequest?: (request: Request) => Response | Promise<Response>;
~~~~~~~
node_modules/@octokit/oauth-app/dist-types/middleware/web-worker/index.d.ts:5:48 - error TS2304: Cannot find name 'Response'.
5 onUnhandledRequest?: (request: Request) => Response | Promise<Response>;
~~~~~~~~
node_modules/@octokit/oauth-app/dist-types/middleware/web-worker/index.d.ts:5:67 - error TS2304: Cannot find name 'Response'.
5 onUnhandledRequest?: (request: Request) => Response | Promise<Response>;
~~~~~~~~
node_modules/@octokit/oauth-app/dist-types/middleware/web-worker/index.d.ts:6:15 - error TS2304: Cannot find name 'Request'.
6 }): (request: Request) => Promise<Response>;
~~~~~~~
node_modules/@octokit/oauth-app/dist-types/middleware/web-worker/index.d.ts:6:35 - error TS2304: Cannot find name 'Response'.
6 }): (request: Request) => Promise<Response>;
~~~~~~~~
node_modules/@octokit/oauth-app/dist-types/middleware/web-worker/index.d.ts:8:143 - error TS2304: Cannot find name 'Request'.
8 export declare function createCloudflareHandler<T extends Options<ClientType>>(...args: Parameters<typeof createWebWorkerHandler>): (request: Request) => Promise<Response>;
~~~~~~~
node_modules/@octokit/oauth-app/dist-types/middleware/web-worker/index.d.ts:8:163 - error TS2304: Cannot find name 'Response'.
8 export declare function createCloudflareHandler<T extends Options<ClientType>>(...args: Parameters<typeof createWebWorkerHandler>): (request: Request) => Promise<Response>;
~~~~~~~~
[11:12:26 am] Found 7 errors. Watching for file changes.
Code of Conduct
- I agree to follow this project's Code of Conduct
Can you please try again, there were some accidental breaking changes that were released.
Describe the need
Typescript not compiling due to missing interface/types
SDK Version
No response
API Version
"octokit": "^2.1.0"
Relevant log output
node_modules/@octokit/oauth-app/dist-types/middleware/web-worker/index.d.ts:5:36 - error TS2304: Cannot find name 'Request'.
5 onUnhandledRequest?: (request: Request) => Response | Promise<Response>;
~~~~~~~
node_modules/@octokit/oauth-app/dist-types/middleware/web-worker/index.d.ts:5:48 - error TS2304: Cannot find name 'Response'.
5 onUnhandledRequest?: (request: Request) => Response | Promise<Response>;
~~~~~~~~
node_modules/@octokit/oauth-app/dist-types/middleware/web-worker/index.d.ts:5:67 - error TS2304: Cannot find name 'Response'.
5 onUnhandledRequest?: (request: Request) => Response | Promise<Response>;
~~~~~~~~
node_modules/@octokit/oauth-app/dist-types/middleware/web-worker/index.d.ts:6:15 - error TS2304: Cannot find name 'Request'.
6 }): (request: Request) => Promise<Response>;
~~~~~~~
node_modules/@octokit/oauth-app/dist-types/middleware/web-worker/index.d.ts:6:35 - error TS2304: Cannot find name 'Response'.
6 }): (request: Request) => Promise<Response>;
~~~~~~~~
node_modules/@octokit/oauth-app/dist-types/middleware/web-worker/index.d.ts:8:143 - error TS2304: Cannot find name 'Request'.
8 export declare function createCloudflareHandler<T extends Options<ClientType>>(...args: Parameters<typeof createWebWorkerHandler>): (request: Request) => Promise<Response>;
~~~~~~~
node_modules/@octokit/oauth-app/dist-types/middleware/web-worker/index.d.ts:8:163 - error TS2304: Cannot find name 'Response'.
8 export declare function createCloudflareHandler<T extends Options<ClientType>>(...args: Parameters<typeof createWebWorkerHandler>): (request: Request) => Promise<Response>;
~~~~~~~~
Found 7 errors in the same file, starting at: node_modules/@octokit/oauth-app/dist-types/middleware/web-worker/index.d.ts:5
You need to include the dom libs in your typescript config. Those types come from the fetch API
thanxs you (sorry for delay)
It doesn't seem correct to add dom
to lib
-- I'm running directly via Node, not in the browser.
I understand, but that is currently the only option, as TypeScript hasn't implemented the Fetch API in the Node types.
The types for the Fetch API are currently only available in the dom
libs
See the discussions over in DefinitelyTyped/DefinitelyTyped#60924