#What should return ClientEvent

4 messages · Page 1 of 1 (latest)

soft tangle

I'm working on removing all any in my code and the last one I can't figure is this one

import {ClientEvents} from 'discord.js';

export class Event<Key extends keyof ClientEvents> {
    constructor(
        public event: Key,
        public run: (...args: ClientEvents[Key]) => any,
    ) {}
}
...
const eventFiles = await globPromise(`${__dirname}/../events/*{.ts,.js}`);
        for (const filePath of eventFiles) {
            const event: Event<keyof ClientEvents> = await DiscordClient.importFile(filePath);
            this.on(event.event, event.run);
        }

I tried never/unkown or Awaitable<void> but this throw error on runtime?

misty narwhal

use void there

but this throw error on runtime?
you have other issues.

what runtime errors are you getting