Commit f1f20e6a authored by nanahira's avatar nanahira

catchup

parent f1b1c6ae
This diff is collapsed.
......@@ -39,7 +39,7 @@
"testEnvironment": "node"
},
"devDependencies": {
"@koishijs/plugin-adapter-onebot": "^4.1.5",
"@koishijs/plugin-adapter-onebot": "^4.2.4",
"@types/jest": "^27.4.0",
"@types/lodash": "^4.14.178",
"@types/mustache": "^4.1.2",
......@@ -55,7 +55,7 @@
"rimraf": "^3.0.2",
"supertest": "^6.2.2",
"ts-jest": "^27.1.3",
"typescript": "^4.5.5"
"typescript": "^4.6.4"
},
"dependencies": {
"@types/koa": "^2.13.4",
......@@ -66,6 +66,6 @@
"typed-reflector": "^1.0.10"
},
"peerDependencies": {
"koishi": "^4.7.0"
"koishi": "^4.7.1"
}
}
......@@ -10,21 +10,21 @@ import {
KoishiOnContextScope,
OnContextFunction,
PickEventFunction,
PluginDefinition,
TopLevelActionDef,
TypedMethodDecorator,
} from '../def';
import 'reflect-metadata';
import {
Argv,
Awaitable,
BeforeEventMap,
Command,
Dict,
Events,
FieldCollector,
I18n,
Selection,
Session,
I18n,
Awaitable,
Middleware,
} from 'koishi';
import { Metadata } from '../meta/metadata.decorators';
import { CommandPut, DoRegister } from '../registry';
......@@ -33,7 +33,6 @@ import {
applyOptionToCommand,
registerTemplate,
} from '../utility';
import { EventMap, BeforeEventMap } from 'koishi';
// Register method
......@@ -42,7 +41,7 @@ export const UseMiddleware = (prepend = false) =>
export const UseEvent = <K extends EventName>(
name: K,
prepend = false,
): TypedMethodDecorator<PickEventFunction<EventMap, K>> =>
): TypedMethodDecorator<PickEventFunction<Events, K>> =>
DoRegister.event({ name, prepend });
export const UseBeforeEvent = <K extends BeforeEventName>(
name: K,
......
import {
Argv,
Awaitable,
Command,
Context,
Dict,
EventMap,
Events,
I18n,
Plugin,
Selection,
I18n,
Awaitable,
} from 'koishi';
import type { DefaultContext, DefaultState, ParameterizedContext } from 'koa';
import type { RouterParamContext } from '@koa/router';
import { CommandPut } from '../registry/registries/command-put';
import { CommandPut } from '../registry';
export interface Type<T = any> extends Function {
new (...args: any[]): T;
......@@ -62,7 +62,7 @@ export interface CommonEventNameAndPrepend<T extends keyof any> {
prepend?: boolean;
}
export type EventName = keyof EventMap;
export type EventName = keyof Events;
export type EventNameAndPrepend = CommonEventNameAndPrepend<EventName>;
type OmitSubstring<
......
import { MappingStruct } from '../def';
import { renderObject } from '../utility';
export class AbstractRegistry<M extends Record<string | number | symbol, any>> {
private map = new Map<keyof M, any>();
......
......@@ -4,7 +4,7 @@ import {
Awaitable,
BeforeEventMap,
Context,
EventMap,
Events,
I18n,
MaybeArray,
Middleware,
......@@ -84,7 +84,7 @@ export namespace DoRegister {
export interface DecoratorMap {
middleware: Middleware;
onEvent: PickEventFunction<EventMap, EventName>;
onEvent: PickEventFunction<Events, EventName>;
beforeEvent: PickEventFunction<BeforeEventMap, BeforeEventName>;
plugin(): Awaitable<PluginDefinition | undefined>;
command(...args: any[]): Awaitable<string | void | undefined>;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment