-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
patch: 🩹 (
@elysiajs/cors
, @elysiajs/server-timing
) Add patches th…
…at resolve TS errors. (#118) - So that `next build` does not fail
- Loading branch information
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
diff --git a/node_modules/@elysiajs/cors/src/index.ts b/node_modules/@elysiajs/cors/src/index.ts | ||
index e3ef50e..8cbd008 100644 | ||
--- a/node_modules/@elysiajs/cors/src/index.ts | ||
+++ b/node_modules/@elysiajs/cors/src/index.ts | ||
@@ -257,18 +257,20 @@ export const cors = ( | ||
} | ||
|
||
const handleMethod = (set: Context['set'], method: string) => { | ||
- if (methods === true) | ||
- return (set.headers['Access-Control-Allow-Methods'] = method ?? '*') | ||
+ if (methods === true) | ||
+ return (set.headers['Access-Control-Allow-Methods'] = method ?? '*') | ||
|
||
- if (methods === false || !methods?.length) return | ||
+ if (methods === false || !methods?.length) return | ||
|
||
- if (methods === '*') | ||
- return (set.headers['Access-Control-Allow-Methods'] = '*') | ||
+ if (methods === '*') | ||
+ return (set.headers['Access-Control-Allow-Methods'] = '*') | ||
|
||
- if (!Array.isArray(methods)) | ||
- return (set.headers['Access-Control-Allow-Methods'] = methods) | ||
+ if (!Array.isArray(methods)) | ||
+ return (set.headers['Access-Control-Allow-Methods'] = methods) | ||
|
||
- set.headers['Access-Control-Allow-Methods'] = methods.join(', ') | ||
+ set.headers['Access-Control-Allow-Methods'] = methods.join(', ') | ||
+ | ||
+ return // Added to prevent "Type error: Not all code paths return a value." | ||
} | ||
|
||
if (preflight) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
diff --git a/node_modules/@elysiajs/server-timing/src/index.ts b/node_modules/@elysiajs/server-timing/src/index.ts | ||
index 12bca07..fbf86c2 100644 | ||
--- a/node_modules/@elysiajs/server-timing/src/index.ts | ||
+++ b/node_modules/@elysiajs/server-timing/src/index.ts | ||
@@ -109,6 +109,7 @@ export const serverTiming = (options: ServerTimingOptions = {}) => { | ||
parse: traceParse = true, | ||
transform: traceTransform = true, | ||
beforeHandle: traceBeforeHandle = true, | ||
+ // @ts-expect-error Added to prevent `next build` to fail with "traceHandler is defined but never used." | ||
handle: traceHandle = true, | ||
afterHandle: traceAfterHandle = true, | ||
total: traceTotal = true |