chorus/src/types.ts

24 lines
636 B
TypeScript
Raw Normal View History

2024-12-24 14:43:23 +00:00
import {z} from "zod";
const commentsConfigSchema = z.object({
mail: z.object({
imap: z.object({
host: z.string(),
port: z.number({ coerce: true }),
auth: z.object({
user: z.string(),
pass: z.string(),
}),
}),
threads: z.object({
type: z.string(), // fixme : in validation
template: z.string(),
}),
}),
})
export type CommentsConfig = z.infer<typeof commentsConfigSchema>
export const castCommentsConfig = (what: unknown): CommentsConfig => {
return commentsConfigSchema.parse(what)
}