Raw event not present in typings
See original GitHub issuePlease describe the problem you are having in as much detail as possible: client.on(“raw”…) throws an error when using typescript in strict mode
Include a reproducible code sample here, if possible:
typescript:
import { Client } from "discord.js";
const client = new Client();
client.on("raw", (pk) => {
console.log(pk);
});
Error message
return new TSError(diagnosticText, diagnosticCodes)
^
TSError: ⨯ Unable to compile TypeScript:
src/index.ts:5:11 - error TS2345: Argument of type '"raw"' is not assignable to parameter of type '"channelCreate" | "channelDelete" | "channelPinsUpdate" | "channelUpdate" | "debug" | "warn" | "disconnect" | "emojiCreate" | "emojiDelete" | "emojiUpdate" | "error" | "guildBanAdd" | ... 37 more ... | "shardResume"'.
5 client.on("raw", (pk) => {
~~~~~
at createTSError (C:\Users\kkm\Workspace\moonbot\node_modules\ts-node\src\index.ts:434:12)
at reportTSError (C:\Users\kkm\Workspace\moonbot\node_modules\ts-node\src\index.ts:438:19)
at getOutput (C:\Users\kkm\Workspace\moonbot\node_modules\ts-node\src\index.ts:578:36)
at Object.compile (C:\Users\kkm\Workspace\moonbot\node_modules\ts-node\src\index.ts:775:32)
at Module.m._compile (C:\Users\kkm\Workspace\moonbot\node_modules\ts-node\src\index.ts:858:43)
at Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Object.require.extensions.<computed> [as .ts] (C:\Users\kkm\Workspace\moonbot\node_modules\ts-node\src\index.ts:861:12)
at Module.load (internal/modules/cjs/loader.js:643:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:839:10)
The same code run using javascript works perfectly
Further details:
- discord.js version: 12.2
- Node.js version: 12.6, but running with ts-jest (tested with typescript 3.8.3 and 3.9.1-rc)
- Operating system: windows 10
- Priority this issue should have – please be realistic and elaborate if possible: idk
- I have also tested the issue on latest master, commit hash: a6510d6a6185b0b589e3aecb1b22b97bdf50fd04
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Cannot get raw value from (including dot(.)) from HTML input ...
I've myself faced this issue earlier. Maybe this can help: $("#n").on("keyup", function(event){ var val = $('#n').val(); if(event.
Read more >Error POSTing Raw events - Seq Documentation
Hello, Followed the example code to the t for posting json with a c# poco to Seq, unfortunately I keep getting "BadRequest". Here's...
Read more >Introduction to events - Learn web development | MDN
Events are actions or occurrences that happen in the system you are programming, which the system tells you about so your code can...
Read more >Is it possible to hide the raw data (events) in a - Splunk Answers
But users can still go to the Search view using the Search button or even typing search after the app name in the...
Read more >Literal types and Enums - mypy 0.991 documentation
These types were added to typing in Python 3.8, but are also available for use in Python ... Literals may not contain any...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The
raw
event is not supported (exists but discouraged) by discord.js. You can// @ts-ignore
it or add it to your own typings.You want to take a look at the
WebSocketManager
then, you can listen to the raw dispatches there.