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.

TS2339: Property 'send' does not exist on type 'Channel'.

See original GitHub issue

Just installed this lib and I’m getting TS2339: Property 'send' does not exist on type 'Channel'. I guess you need to update the types.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:9
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

26reactions
vzwGreycommented, Dec 13, 2019

The Channel class does not have a send method, because categories and voice channels are also a child classes of the Channel class. When you’re certain you have a text channel you can cast it to a TextChannel like so:

(channel as TextChannel).send('hello!');

You have to import TextChannel from the discord.js library for it to work.

For further questions please come by the official Discord server.

8reactions
stevemarksdcommented, Dec 13, 2019

the tutorial says this: https://discordjs.guide/popular-topics/common-questions.html#how-do-i-send-a-message-to-a-certain-channel I guess the tutorial is wrong in this case.

I think the casting solution is just a hack, not a proper solution or I am wrong?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Property does not exist on type Request in TypeScript
The "Property does not exist on type Request" error occurs when we access a property that does not exist in the Request interface....
Read more >
cast or convert GuildChannel to TextChannel-discord.js
If you are using Typescript and are getting the error Property 'send' does not exist on type 'GuildChannel'.ts(2339) . You can fix this...
Read more >
error ts2339: property 'findoperator' does not exist on type nestjs
To fix the error “TS2339: Property 'x' does not exist on type 'Y'” with TypeScript, we should make sure the properties are listed...
Read more >
Build a 100 Days of Code Discord Bot with TypeScript ...
This is because while we know the environment variable exists, TypeScript still cannot infer it. The validation function is set up to exit...
Read more >
How to resolve the error ' Error:(54,6) TS2339:property 'name ...
How do I resolve the error " Error:(54,6) TS2339:property 'name' does not exist on type ' {}' " in JavaScript?
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