discord.js-light: Property 'forceSet' does not exist on type 'Collection'

When using typescipt, then forceSet function from cache manager doesn’t exists

Property 'forceSet' does not exist on type 'Collection<string, Channel>'

This error is from

this.client.channels.cache.forceSet(interaction.channelId, channel);

I am trying to migrate from djs to djs-light, and for permissions i am using the first example in README.md from here, and that error appears inside of that if

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 18 (18 by maintainers)

Most upvoted comments

 if (!this.client.channels.cache.has(interaction.channelId)) {
      const channel = await this.client.channels.fetch(interaction.channelId).catch(() => null);
      if (channel) {
        (this.client.channels.cache as Collection<string, ThreadChannel | GuildChannel>).forceSet(
          interaction.channelId,
          channel,
        );
        (
          interaction.guild?.channels.cache as Collection<string, ThreadChannel | GuildChannel>
        ).forceSet(interaction.channelId, channel);
      }
    }

This is my final code taking from reference the first example in your readme, it works pretty well

Oky Doki, it just to create a PR to change the readme with my information, right?