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:
2 files changed
+10
-3
No files matched your search
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user