mirror of
https://github.com/hexastack/hexabot
synced 2025-02-22 12:28:26 +00:00
fix: typing & remove type assertion
This commit is contained in:
parent
1f8285a09c
commit
4e80a0a215
@ -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,
|
||||
});
|
||||
|
||||
|
@ -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(),
|
||||
|
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user