@kyvrixon/utils 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kyvrixon/utils",
3
3
  "main": "./src/index.ts",
4
- "version": "1.4.0",
4
+ "version": "1.4.1",
5
5
  "type": "module",
6
6
  "private": false,
7
7
  "license": "MIT",
@@ -21,13 +21,13 @@
21
21
  },
22
22
  "types": "./src/index.ts",
23
23
  "devDependencies": {
24
- "@biomejs/biome": "2.4.9",
24
+ "@biomejs/biome": "2.4.10",
25
25
  "@types/bun": "1.3.11",
26
26
  "typescript": "6.0.2"
27
27
  },
28
28
  "dependencies": {
29
29
  "chalk": "5.6.2",
30
- "discord.js": "14.25.1"
30
+ "discord.js": "14.26.0"
31
31
  },
32
32
  "exports": {
33
33
  ".": {
@@ -10,32 +10,29 @@ import type { Client, ClientEvents, RestEvents } from "discord.js";
10
10
  * }
11
11
  * }
12
12
  */
13
- // biome-ignore lint/suspicious/noEmptyInterface: Its fine
13
+ // biome-ignore lint/suspicious/noEmptyInterface: It's fine
14
14
  export interface DiscordEventCustomType {}
15
15
 
16
16
  /** Maps an event type discriminant to its corresponding event map. */
17
- type EventMap<T extends "client" | "rest" | "custom"> = T extends "client"
18
- ? ClientEvents
19
- : T extends "rest"
20
- ? RestEvents
21
- : keyof DiscordEventCustomType extends never
22
- ? { "sooo.. there's no custom events..": [] }
23
- : DiscordEventCustomType;
17
+ export type EventMap<T extends "client" | "rest" | "custom"> =
18
+ T extends "client"
19
+ ? ClientEvents
20
+ : T extends "rest"
21
+ ? RestEvents
22
+ : keyof DiscordEventCustomType extends never
23
+ ? { "sooo.. there's no custom events..": [] }
24
+ : DiscordEventCustomType;
24
25
 
25
26
  /** Resolves the argument tuple for a given event type + key pair. */
26
- type EventArgs<
27
+ export type EventArgs<
27
28
  T extends "client" | "rest" | "custom",
28
29
  K extends keyof EventMap<T>,
29
30
  > = Extract<EventMap<T>[K], any[]>;
30
31
 
31
32
  /**
32
33
  * Wraps a discord.js event handler. Supports `"client"`, `"rest"`, and `"custom"` event types.
33
- * @typeParam V - The bot's `Client` type.
34
- * @typeParam T - The event source discriminant.
35
- * @typeParam K - The event name within the chosen source.
36
34
  */
37
35
  export class DiscordEvent<
38
- V extends Client,
39
36
  T extends "client" | "rest" | "custom",
40
37
  K extends keyof EventMap<T> = keyof EventMap<T>,
41
38
  > {
@@ -43,7 +40,7 @@ export class DiscordEvent<
43
40
  public readonly name: K;
44
41
  public readonly once: boolean;
45
42
  public readonly method: (
46
- client: V,
43
+ client: Client<true>,
47
44
  ...args: EventArgs<T, K>
48
45
  ) => void | Promise<void>;
49
46
 
@@ -51,7 +48,7 @@ export class DiscordEvent<
51
48
  type: T;
52
49
  name: K;
53
50
  once: boolean;
54
- method: DiscordEvent<V, T, K>["method"];
51
+ method: DiscordEvent<T, K>["method"];
55
52
  }) {
56
53
  this.type = opts.type;
57
54
  this.name = opts.name;