fix: typing & remove type assertion

This commit is contained in:
abdou6666 2025-02-05 11:41:09 +01:00
parent 1f8285a09c
commit 4e80a0a215
3 changed files with 4 additions and 8 deletions

View File

@ -280,10 +280,7 @@ export type StdOutgoingButtonsEnvelope = z.infer<
>;
export const stdOutgoingListEnvelopeSchema = z.object({
format: z.union([
z.literal(OutgoingMessageFormat.list),
z.literal(OutgoingMessageFormat.carousel),
]),
format: z.enum(['list', 'carousel']),
message: stdOutgoingListMessageSchema,
});

View File

@ -9,10 +9,9 @@
import { z } from 'zod';
import { buttonSchema } from './button';
import { OutgoingMessageFormat } from './message';
export const contentOptionsSchema = z.object({
display: z.nativeEnum(OutgoingMessageFormat),
display: z.enum(['list', 'carousel']),
fields: z.object({
title: z.string(),
subtitle: z.string().nullable(),

View File

@ -576,13 +576,13 @@ export class BlockService extends BaseService<
contentBlockOptions,
skip,
);
const envelope = {
const envelope: StdOutgoingEnvelope = {
format: contentBlockOptions.display,
message: {
...results,
options: contentBlockOptions,
},
} as StdOutgoingEnvelope;
};
return envelope;
} catch (err) {
this.logger.error(