Skip to content

Commit 629b118

Browse files
committed
fix typecast
1 parent 25598af commit 629b118

File tree

8 files changed

+10
-9
lines changed

8 files changed

+10
-9
lines changed

Diff for: packages/parser/src/envelopes/apigw.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ export const ApiGatewayEnvelope = {
3636
};
3737
}
3838

39-
return parsedBody as ParsedResultSuccess<z.infer<T>>;
39+
return parsedBody;
4040
},
4141
};

Diff for: packages/parser/src/envelopes/apigwv2.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ export const ApiGatewayV2Envelope = {
4040
}
4141

4242
// use type assertion to avoid type check, we know it's success here
43-
return parsedBody as ParsedResultSuccess<z.infer<T>>;
43+
return parsedBody;
4444
},
4545
};

Diff for: packages/parser/src/envelopes/envelope.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { ZodSchema, z } from 'zod';
22
import { ParseError } from '../errors.js';
3+
import type { ParsedResult } from '../types';
34

45
export const Envelope = {
56
/**
@@ -34,7 +35,7 @@ export const Envelope = {
3435
* @param input
3536
* @param schema
3637
*/
37-
safeParse<T extends ZodSchema>(input: unknown, schema: T) {
38+
safeParse<T extends ZodSchema>(input: unknown, schema: T): ParsedResult {
3839
try {
3940
if (typeof input !== 'object' && typeof input !== 'string') {
4041
return {

Diff for: packages/parser/src/envelopes/event-bridge.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ export const EventBridgeEnvelope = {
3737
};
3838
}
3939

40-
return parsedDetail as ParsedResultSuccess<z.infer<T>>;
40+
return parsedDetail;
4141
},
4242
};

Diff for: packages/parser/src/envelopes/lambda.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ export const LambdaFunctionUrlEnvelope = {
4040
};
4141
}
4242

43-
return parsedBody as ParsedResultSuccess<z.infer<T>>;
43+
return parsedBody;
4444
},
4545
};

Diff for: packages/parser/src/envelopes/vpc-lattice.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ export const VpcLatticeEnvelope = {
3939
};
4040
}
4141

42-
return parsedBody as ParsedResultSuccess<z.infer<T>>;
42+
return parsedBody;
4343
},
4444
};

Diff for: packages/parser/src/envelopes/vpc-latticev2.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { ZodSchema, z } from 'zod';
22
import { ParseError } from '../errors.js';
33
import { VpcLatticeV2Schema } from '../schemas/index.js';
4-
import type { ParsedResult, ParsedResultSuccess } from '../types/index.js';
4+
import type { ParsedResult } from '../types/index.js';
55
import { Envelope } from './envelope.js';
66

77
/**
@@ -38,6 +38,6 @@ export const VpcLatticeV2Envelope = {
3838
};
3939
}
4040

41-
return parsedBody as ParsedResultSuccess<z.infer<T>>;
41+
return parsedBody;
4242
},
4343
};

Diff for: packages/parser/src/types/parser.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type ParsedResultSuccess<Output> = {
2828
type ParsedResultError<Input> = {
2929
success: false;
3030
error: ZodError | Error;
31-
originalEvent: Input;
31+
originalEvent?: Input;
3232
};
3333

3434
/**

0 commit comments

Comments
 (0)