Commit d2405868 authored by nanahira's avatar nanahira

fix middleware type

parent 8a94475b
......@@ -64,7 +64,7 @@ export class KoishiRegistrar extends SatoriRegistrar<Context> {
'middleware',
(
{ ctx },
fun: (session: Session, next: Next) => CanBeObserved<string>,
fun: (session: Session, next: Next) => CommandReturnType,
prepend?: boolean,
) =>
ctx.middleware(
......
......@@ -5,7 +5,7 @@ export type CanBeObserved<T> = Awaitable<T | Observable<T>>;
export async function sessionRxToPromise(
session: Session,
obs: CanBeObserved<string>,
obs: CanBeObserved<string | void>,
) {
const obsAwaited = await obs;
if (!isObservable(obsAwaited)) {
......@@ -18,7 +18,7 @@ export async function sessionRxToPromise(
if (lastValue && session.send) {
await session.send(lastValue);
}
lastValue = value;
lastValue = value as string;
},
error: async (error) => {
if (lastValue && session.send) {
......
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