File tree 8 files changed +10
-9
lines changed
8 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,6 @@ export const ApiGatewayEnvelope = {
36
36
} ;
37
37
}
38
38
39
- return parsedBody as ParsedResultSuccess < z . infer < T > > ;
39
+ return parsedBody ;
40
40
} ,
41
41
} ;
Original file line number Diff line number Diff line change @@ -40,6 +40,6 @@ export const ApiGatewayV2Envelope = {
40
40
}
41
41
42
42
// use type assertion to avoid type check, we know it's success here
43
- return parsedBody as ParsedResultSuccess < z . infer < T > > ;
43
+ return parsedBody ;
44
44
} ,
45
45
} ;
Original file line number Diff line number Diff line change 1
1
import type { ZodSchema , z } from 'zod' ;
2
2
import { ParseError } from '../errors.js' ;
3
+ import type { ParsedResult } from '../types' ;
3
4
4
5
export const Envelope = {
5
6
/**
@@ -34,7 +35,7 @@ export const Envelope = {
34
35
* @param input
35
36
* @param schema
36
37
*/
37
- safeParse < T extends ZodSchema > ( input : unknown , schema : T ) {
38
+ safeParse < T extends ZodSchema > ( input : unknown , schema : T ) : ParsedResult {
38
39
try {
39
40
if ( typeof input !== 'object' && typeof input !== 'string' ) {
40
41
return {
Original file line number Diff line number Diff line change @@ -37,6 +37,6 @@ export const EventBridgeEnvelope = {
37
37
} ;
38
38
}
39
39
40
- return parsedDetail as ParsedResultSuccess < z . infer < T > > ;
40
+ return parsedDetail ;
41
41
} ,
42
42
} ;
Original file line number Diff line number Diff line change @@ -40,6 +40,6 @@ export const LambdaFunctionUrlEnvelope = {
40
40
} ;
41
41
}
42
42
43
- return parsedBody as ParsedResultSuccess < z . infer < T > > ;
43
+ return parsedBody ;
44
44
} ,
45
45
} ;
Original file line number Diff line number Diff line change @@ -39,6 +39,6 @@ export const VpcLatticeEnvelope = {
39
39
} ;
40
40
}
41
41
42
- return parsedBody as ParsedResultSuccess < z . infer < T > > ;
42
+ return parsedBody ;
43
43
} ,
44
44
} ;
Original file line number Diff line number Diff line change 1
1
import type { ZodSchema , z } from 'zod' ;
2
2
import { ParseError } from '../errors.js' ;
3
3
import { VpcLatticeV2Schema } from '../schemas/index.js' ;
4
- import type { ParsedResult , ParsedResultSuccess } from '../types/index.js' ;
4
+ import type { ParsedResult } from '../types/index.js' ;
5
5
import { Envelope } from './envelope.js' ;
6
6
7
7
/**
@@ -38,6 +38,6 @@ export const VpcLatticeV2Envelope = {
38
38
} ;
39
39
}
40
40
41
- return parsedBody as ParsedResultSuccess < z . infer < T > > ;
41
+ return parsedBody ;
42
42
} ,
43
43
} ;
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ type ParsedResultSuccess<Output> = {
28
28
type ParsedResultError < Input > = {
29
29
success : false ;
30
30
error : ZodError | Error ;
31
- originalEvent : Input ;
31
+ originalEvent ? : Input ;
32
32
} ;
33
33
34
34
/**
You can’t perform that action at this time.
0 commit comments