Skip to content

Commit

Permalink
fix: fix external typings being exported
Browse files Browse the repository at this point in the history
  • Loading branch information
Snazzah committed Nov 6, 2023
1 parent 559cb36 commit c035fda
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 16 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
"undici": "^5.27.0"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20231025.0",
"@microsoft/eslint-formatter-sarif": "^3.0.0",
"@sinonjs/fake-timers": "6.0.1",
"@types/aws-lambda": "^8.10.125 ",
Expand Down
7 changes: 0 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ export interface RawRequest {
files: FileContent[] | undefined;
latency: number;
method: string;
response: Response;
response: any;
url: URL;
}

Expand Down
6 changes: 3 additions & 3 deletions src/servers/bun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ export class BunServer extends Server {
* creator.withServer(workerServer);
* export default workerServer;
*/
readonly fetch = async (request: Request) => {
readonly fetch = async (request: any) => {
if (!this._handler) return new Response('Server has no handler.', { status: 503 });
if (request.method !== 'POST') return new Response('Server only supports POST requests.', { status: 405 });
const body = await request.text();
return new Promise((resolve, reject) => {
this._handler!(
{
headers: Object.fromEntries((request as any).headers.entries()),
headers: Object.fromEntries(request.headers.entries()),
body: body ? JSON.parse(body) : body,
request,
response: null
Expand Down Expand Up @@ -59,7 +59,7 @@ export class BunServer extends Server {
);
}
).catch(reject);
}) as Promise<Response>;
}) as Promise<any>;
};

/** @private */
Expand Down
6 changes: 2 additions & 4 deletions src/servers/cfworker.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { Server, ServerRequestHandler } from '../server';
// @ts-ignore
import type { Request as WorkerRequest, ExecutionContext } from '@cloudflare/workers-types';

/**
* A server for Cloudflare Workers.
Expand All @@ -20,7 +18,7 @@ export class CloudflareWorkerServer extends Server {
* creator.withServer(workerServer);
* export default workerServer;
*/
readonly fetch = async (request: WorkerRequest, env: Record<string, object>, ctx: ExecutionContext) => {
readonly fetch = async (request: any, env: any, ctx: any) => {
if (!this._handler) return new Response('Server has no handler.', { status: 503 });
if (request.method !== 'POST') return new Response('Server only supports POST requests.', { status: 405 });
const body = await request.text();
Expand Down Expand Up @@ -57,7 +55,7 @@ export class CloudflareWorkerServer extends Server {
}
).catch(reject)
);
}) as Promise<Response>;
}) as Promise<any>;
};

/** @private */
Expand Down

0 comments on commit c035fda

Please sign in to comment.