Skip to content

Commit 370a6ac

Browse files
committed
📘 doc: document change
1 parent f8a52b9 commit 370a6ac

File tree

3 files changed

+26
-19
lines changed

3 files changed

+26
-19
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
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
25
Improvement:
36
- use imperative check for `replaceURLPath` instead of allocating `new URL`

example/a.ts

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
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+
)

src/utils.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff 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

404403
const isBun = typeof Bun !== 'undefined'
405-
const hasBunHash = isBun && typeof Bun.hash === 'function'
406404
export const hasSetImmediate = typeof setImmediate === 'function'
407405

408406
// https://stackoverflow.com/a/52171480

0 commit comments

Comments
 (0)