attempting to resolve type issues

This commit is contained in:
Luke Hagar
2025-02-02 14:02:35 -06:00
parent bc55c9765f
commit f4bf13cc38
2 changed files with 20 additions and 11 deletions

View File

@@ -66,11 +66,14 @@ export class AdapterHookable {
}; };
} }
} catch (error) { } catch (error) {
const errResponse = (error as { response: Response }).response || error; if (
if (errResponse instanceof Response) { error instanceof Response ||
(error && typeof error === "object" && "response" in error && typeof error.response === "function")
) {
const response = error instanceof Response ? error : (error as { response: () => Response }).response();
return { return {
context, context,
endResponse: errResponse, endResponse: response,
}; };
} }
throw error; throw error;

View File

@@ -1,14 +1,20 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "ESNext", "allowJs": true,
"module": "ESNext", "checkJs": true,
"moduleResolution": "Node",
"esModuleInterop": true,
"skipLibCheck": true, "skipLibCheck": true,
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"esModuleInterop": true,
"strict": true, "strict": true,
"allowImportingTsExtensions": true, "allowImportingTsExtensions": true,
"allowSyntheticDefaultImports": true,
"noEmit": true, "noEmit": true,
"types": ["node", "@cloudflare/workers-types", "deno"] "types": [
}, "node",
"include": ["src", "test"] "@cloudflare/workers-types",
} "deno"
]
}
}