mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-03-01 16:20:25 +00:00
迁移类型校验到zod
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user