File tree Expand file tree Collapse file tree 3 files changed +26
-19
lines changed
Expand file tree Collapse file tree 3 files changed +26
-19
lines changed Original file line number Diff line number Diff line change 1+ # 1.4.23
2+ - [ #1683 ] ( https://github.com/elysiajs/elysia/pull/1683 ) response validation returns 500 instead of 422 for nested schemas in dynamic mode
3+
14# 1.4.22 - 14 Jan 2026
25Improvement:
36- use imperative check for ` replaceURLPath ` instead of allocating ` new URL `
Original file line number Diff line number Diff line change 1- import { Elysia } from '../src'
1+ import { Elysia , t } from '../src'
22
3- new Elysia ( )
4- . post (
5- "/create-post" ,
6- async ( ctx ) => {
7- return {
8- message : "Post Created" ,
9- data : ctx . body ,
10- } ;
11- } ,
12- {
13- body : t . Object ( {
14- name : t . String ( ) ,
15- content : t . String ( ) ,
16- safeAge : t . Number ( ) ,
17- } ) ,
18- } ,
3+ const verifyToken = new Elysia ( )
4+ . macro ( 'verifyToken' , {
5+ headers : t . Object ( {
6+ authorization : t . String ( )
7+ } ) ,
8+ resolve ( { headers } ) {
9+ // headers should be typed as { authorization: string }
10+ // but TypeScript shows: Record<string, string | undefined>
11+ const token = headers . authorization // Type is 'string | undefined', not 'string'
12+ ? headers . authorization . substring ( 7 )
13+ : undefined
14+
15+ return { token }
16+ }
17+ } )
18+ . get (
19+ '/' ,
20+ ( { token } ) => { } ,
21+ {
22+ verifyToken : true
23+ }
24+ )
Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ import type {
55 LifeCycleStore ,
66 MaybeArray ,
77 InputSchema ,
8- BaseMacro ,
98 LifeCycleType ,
109 HookContainer ,
1110 GracefulHandler ,
@@ -402,7 +401,6 @@ export const lifeCycleToArray = (a: LifeCycleStore) => {
402401}
403402
404403const isBun = typeof Bun !== 'undefined'
405- const hasBunHash = isBun && typeof Bun . hash === 'function'
406404export const hasSetImmediate = typeof setImmediate === 'function'
407405
408406// https://stackoverflow.com/a/52171480
You can’t perform that action at this time.
0 commit comments