Skip to content

Commit ce3fc4f

Browse files
committed
Fixed the SonarQube finding
1 parent f1e8f70 commit ce3fc4f

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

packages/batch/src/BatchProcessor.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -218,15 +218,12 @@ class BatchProcessor extends BasePartialBatchProcessor {
218218
record: EventSourceDataClassTypes,
219219
eventType: keyof typeof EventType,
220220
schema: StandardSchemaV1
221-
): Promise<SQSRecord | KinesisStreamRecord | DynamoDBRecord> {
221+
): Promise<EventSourceDataClassTypes> {
222222
const { parse } = await import('@aws-lambda-powertools/parser');
223223
// Try parsing with the original schema first
224224
const extendedSchemaParsing = parse(record, undefined, schema, true);
225225
if (extendedSchemaParsing.success) {
226-
return extendedSchemaParsing.data as
227-
| SQSRecord
228-
| KinesisStreamRecord
229-
| DynamoDBRecord;
226+
return extendedSchemaParsing.data as EventSourceDataClassTypes;
230227
}
231228
// Only proceed with schema extension if it's a Zod schema
232229
if (schema['~standard'].vendor !== SchemaType.Zod) {
@@ -237,10 +234,11 @@ class BatchProcessor extends BasePartialBatchProcessor {
237234
}
238235
// Handle schema extension based on event type
239236
const extendedSchema = await this.createExtendedSchema(eventType, schema);
240-
return parse(record, undefined, extendedSchema) as
241-
| SQSRecord
242-
| KinesisStreamRecord
243-
| DynamoDBRecord;
237+
return parse(
238+
record,
239+
undefined,
240+
extendedSchema
241+
) as EventSourceDataClassTypes;
244242
}
245243
}
246244

0 commit comments

Comments
 (0)