Skip to content

Commit

Permalink
fix: unregister types for Component.ts and Listener.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
S222em committed Mar 19, 2022
1 parent 88ea7c3 commit 1817f9c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/lib/structures/Component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ const validationSchema = z
cooldown: z.string().optional(),
autoDefer: z
.union([z.string(), z.nativeEnum(AutoDeferType)])
.transform((arg) => (typeof arg === 'string' && Object.keys(AutoDeferType).includes(arg) ? AutoDeferType[arg] : arg))
.transform((arg) =>
typeof arg === 'string' && Object.keys(AutoDeferType).includes(arg) ? AutoDeferType[arg] : arg,
)
.optional(),
fileName: z.string().optional(),
run: z.function(),
Expand Down Expand Up @@ -96,8 +98,8 @@ export class Component {
if (!this.guildId && client.options?.devGuildId) this.guildId = client.options.devGuildId;
}

public unregister() {
Components.unregister(this.name);
public unregister(): Component | undefined {
return Components.unregister(this.name);
}

public async inhibit(ctx: ComponentContext): Promise<boolean> {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/structures/Listener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ export class Listener<
else client[this.once ? 'once' : 'on'](this.event as keyof ClientEvents, this._run.bind(this));
}

public unregister(): void {
Listeners.unregister(this.name);
public unregister(): Listener | void {
return Listeners.unregister(this.name);
}

public async _run(...args: Array<any>): Promise<void> {
Expand Down

0 comments on commit 1817f9c

Please sign in to comment.