File tree Expand file tree Collapse file tree 3 files changed +31
-9
lines changed Expand file tree Collapse file tree 3 files changed +31
-9
lines changed Original file line number Diff line number Diff line change
1
+ # 1.2.24 - 2 Mar 2025
2
+ Bug fix:
3
+ - 200 object response is not inferring type in type-level
4
+ -
5
+
1
6
# 1.2.23 - 25 Feb 2025
2
7
Bug fix:
3
8
- [ #1087 ] ( https://github.com/elysiajs/elysia/pull/1087 ) websocket to parse string array
Original file line number Diff line number Diff line change 1
- import { Elysia , t } from '../src'
2
- import { hasTransform } from '../src/compose'
3
- import { post , req } from '../test/utils'
1
+ import { Elysia , error , t } from '../src'
2
+ import { req } from '../test/utils'
4
3
5
- import { treaty } from '../../eden'
4
+ const app = new Elysia ( ) . get (
5
+ '/' ,
6
+ ( ) => {
7
+ return {
8
+ name : 'a' ,
9
+ a : 'b'
10
+ }
11
+ } ,
12
+ {
13
+ response : {
14
+ 200 : t . Object ( {
15
+ name : t . String ( )
16
+ } )
17
+ }
18
+ }
19
+ )
20
+
21
+ app . handle ( req ( '/' ) )
22
+ . then ( ( x ) => x . json ( ) )
23
+ . then ( console . log )
Original file line number Diff line number Diff line change @@ -723,8 +723,7 @@ export type InlineHandler<
723
723
derive : { }
724
724
resolve : { }
725
725
} ,
726
- Path extends string | undefined = undefined ,
727
- MacroContext = { }
726
+ Path extends string | undefined = undefined
728
727
> =
729
728
| ( ( context : Context < Route , Singleton , Path > ) =>
730
729
| Response
@@ -733,8 +732,9 @@ export type InlineHandler<
733
732
? unknown
734
733
:
735
734
| ( Route [ 'response' ] extends { 200 : any }
736
- ? Route [ 'response' ]
735
+ ? Route [ 'response' ] [ 200 ]
737
736
: string | number | boolean | Object )
737
+ // This could be possible because of set.status
738
738
| Route [ 'response' ] [ keyof Route [ 'response' ] ]
739
739
| {
740
740
[ Status in keyof Route [ 'response' ] ] : ElysiaCustomStatusResponse <
@@ -748,9 +748,8 @@ export type InlineHandler<
748
748
? string | number | boolean | Object
749
749
:
750
750
| ( Route [ 'response' ] extends { 200 : any }
751
- ? Route [ 'response' ]
751
+ ? Route [ 'response' ] [ 200 ]
752
752
: string | number | boolean | Object )
753
- | Route [ 'response' ] [ keyof Route [ 'response' ] ]
754
753
| {
755
754
[ Status in keyof Route [ 'response' ] ] : ElysiaCustomStatusResponse <
756
755
// @ts -ignore Status is always a number
You can’t perform that action at this time.
0 commit comments