question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:18 (18 by maintainers)

github_iconTop GitHub Comments

1reaction
ySnoopyDogycommented, Sep 21, 2021
 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

1reaction
ySnoopyDogycommented, Sep 20, 2021

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript : Property does not exist on type 'object'
I am using JSforce and trying to use "search" function on the object but it is throwing "Property 'search' does not exist on...
Read more >
Unable to run `pxt serve --cloud` · Issue #916 · microsoft/pxt-ev3
Type 'ConsolePriority' is not assignable to type 'string'. pxt_modules/base/control.ts(310,35): error TS2339: Property 'CFG_RAM_BYTES' does ...
Read more >
Index (Jersey 2.29 API) - GitHub Pages
Get value of a property as a definite type property shall exist in order for this ... forceSet(String, String) - Method in class...
Read more >
Diff - platform/cts - Google Git
That channel (e.g. bluetooth or a host test device) is not + * readily available (don't want to have Aware tests dependent on...
Read more >
Index (OpenJPA Parent POM 2.0.1 API) - Apache OpenJPA
Value: Adds a moniker that is equivalent to the original property key used ... Broker: Throw an exception if a write operation is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found