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({ export const stdOutgoingListEnvelopeSchema = z.object({
format: z.union([ format: z.enum(['list', 'carousel']),
z.literal(OutgoingMessageFormat.list),
z.literal(OutgoingMessageFormat.carousel),
]),
message: stdOutgoingListMessageSchema, message: stdOutgoingListMessageSchema,
}); });

View File

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

View File

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