fix(onebot): make the event pipeline tables type-check

A handler shared by several event kinds now types as one kind at a
time. The converter table still records which kinds are not converted,
so the compile-time check for dropped converted kinds works.
This commit is contained in:
DrSmoothl committed 2026-08-30 16:14:56 +08:00
1 parent 6cf461ef8f
commit a7d293d79b
2 files changed
+10 -3

No files matched your search

+2 -2
View File
@@ -73,7 +73,7 @@ type ConverterFor<K extends QQEventVariant['kind']> =
*/
export type ConverterRegistry = { [K in QQEventVariant['kind']]: ConverterFor<K> | null };
export const CONVERTERS: ConverterRegistry = {
export const CONVERTERS = {
// Messages.
friend_message: convertFriendMessage,
group_message: convertGroupMessage,
@@ -107,7 +107,7 @@ export const CONVERTERS: ConverterRegistry = {
online_devices_changed: null,
// Internal-only identity synchronization from another QQ client.
friend_remark_changed: null,
};
} satisfies ConverterRegistry;
export async function convertEvent(
ctx: ConverterContext,