mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-06 13:05:09 +00:00
refactor: type-check (#586)
* refactor: type-check * fix: default * refactor: type-check
This commit is contained in:
@@ -1,17 +1,13 @@
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/onebot/action/router';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
import { Type, Static } from '@sinclair/typebox';
|
||||
|
||||
const SchemaData = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
rawData: { type: 'string' },
|
||||
brief: { type: 'string' },
|
||||
},
|
||||
required: ['brief', 'rawData'],
|
||||
} as const satisfies JSONSchema;
|
||||
const SchemaData = Type.Object({
|
||||
rawData: Type.String(),
|
||||
brief: Type.String(),
|
||||
});
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
type Payload = Static<typeof SchemaData>;
|
||||
|
||||
export class CreateCollection extends OneBotAction<Payload, any> {
|
||||
actionName = ActionName.CreateCollection;
|
||||
@@ -25,4 +21,4 @@ export class CreateCollection extends OneBotAction<Payload, any> {
|
||||
payload.brief, payload.rawData,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user