迁移类型校验到zod

This commit is contained in:
手瓜一十雪
2025-04-13 20:05:11 +08:00
parent d4ab191f34
commit 2147c4ffee
101 changed files with 951 additions and 945 deletions

View File

@@ -1,7 +1,7 @@
import { WebApiGroupNoticeFeed } from '@/core';
import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '@/onebot/action/router';
import { Static, Type } from '@sinclair/typebox';
import { z } from 'zod';
interface GroupNotice {
sender_id: number;
publish_time: number;
@@ -16,11 +16,11 @@ interface GroupNotice {
};
}
const SchemaData = Type.Object({
group_id: Type.Union([Type.Number(), Type.String()]),
const SchemaData = z.object({
group_id: z.union([z.number(), z.string()]),
});
type Payload = Static<typeof SchemaData>;
type Payload = z.infer<typeof SchemaData>;
type ApiGroupNotice = GroupNotice & WebApiGroupNoticeFeed;