all repos — kitten @ 6fd2de35a04159885eb4faefd044adf6885bb66d

kitten: standardise `run` return types
vi did:web:vt3e.cat
Sun, 21 Jun 2026 22:38:13 +0100
commit

6fd2de35a04159885eb4faefd044adf6885bb66d

parent

e62a3d3842b094a58c6a734df76a60864ce4be84

3 files changed, 9 insertions(+), 16 deletions(-)

jump to
M pkgs/router/package.jsonpkgs/router/package.json

@@ -1,6 +1,6 @@

{ "name": "@purrkit/router", - "version": "1.1.0", + "version": "1.2.0", "license": "EUPL-1.2", "author": { "name": "apr",
M pkgs/router/src/commands.tspkgs/router/src/commands.ts

@@ -27,6 +27,7 @@ GUILDS_ONLY: [INTERACTION_CONTEXTS.GUILD],

DMS_ONLY: [INTERACTION_CONTEXTS.BOT_DM, INTERACTION_CONTEXTS.PRIVATE_CHANNEL], }; +export type CommandResultType = Promise<unknown> | void; export type IntegrationType = (typeof INTEGRATION_TYPES)[keyof typeof INTEGRATION_TYPES]; export type InteractionContextType = (typeof INTERACTION_CONTEXTS)[keyof typeof INTERACTION_CONTEXTS];

@@ -59,7 +60,7 @@ run: (

interaction: ChatInputCommandInteraction, args: InferOptions<O>, ctx: Ctx, - ) => Promise<void> | void; + ) => CommandResultType; }, ): this { this.subcommands[name] = new Subcommand(name, config);

@@ -90,7 +91,7 @@ run: (

interaction: ChatInputCommandInteraction, args: InferOptions<O>, ctx: Ctx, - ) => Promise<unknown> | unknown; + ) => CommandResultType; }, ): this { this.subcommands[name] = new Subcommand(name, config);

@@ -156,7 +157,7 @@ run: (

interaction: ChatInputCommandInteraction, args: InferOptions<O>, ctx: Ctx, - ) => Promise<unknown> | unknown; + ) => CommandResultType; }, ): Command;

@@ -186,10 +187,7 @@ | ((interaction: UserContextMenuCommandInteraction, ctx: Ctx) => Promise<unknown> | unknown)

| { integrationTypes?: IntegrationType[]; contexts?: InteractionContextType[]; - run: ( - interaction: UserContextMenuCommandInteraction, - ctx: Ctx, - ) => Promise<unknown> | unknown; + run: (interaction: UserContextMenuCommandInteraction, ctx: Ctx) => CommandResultType; }, ): ContextMenuCommand { if (typeof runOrConfig === "function")

@@ -211,10 +209,7 @@ ) => Promise<unknown> | unknown)

| { integrationTypes?: IntegrationType[]; contexts?: IntegrationType[]; - run: ( - interaction: MessageContextMenuCommandInteraction, - ctx: Ctx, - ) => Promise<void> | void; + run: (interaction: MessageContextMenuCommandInteraction, ctx: Ctx) => CommandResultType; }, ): ContextMenuCommand { if (typeof runOrConfig === "function")
M pkgs/router/src/kitten.tspkgs/router/src/kitten.ts

@@ -25,6 +25,7 @@ SubcommandGroupBuilder,

ContextMenuCommand, type IntegrationType, type InteractionContextType, + CommandResultType, } from "./commands"; import { baseLogger, type KittenLogger } from "./logger";

@@ -58,10 +59,7 @@ description: string;

options?: O; integrationTypes?: IntegrationType[]; contexts?: InteractionContextType[]; - run: ( - interaction: ChatInputCommandInteraction, - args: InferOptions<O>, - ) => Promise<void> | void; + run: (interaction: ChatInputCommandInteraction, args: InferOptions<O>) => CommandResultType; }, ): Command;