Created
January 8, 2024 13:51
-
-
Save ducva/66ad0167f24df27370a67137eb2666f4 to your computer and use it in GitHub Desktop.
zod second
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const ChannelSchema = z.discriminatedUnion('type', [ | |
| z.object({ | |
| id: z.string(), | |
| name: z.string(), | |
| type: z.literal(ChannelType.LINE), | |
| config: LineChannelConfigSchema | |
| }), | |
| z.object({ | |
| id: z.string(), | |
| name: z.string(), | |
| type: z.literal(ChannelType.MAIL), | |
| config: MailChannelConfigSchema | |
| }) | |
| ]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment