TayDex
DIAdiscord.js - Imagine an app
•Created by TayDex on 3/25/2024 in #djs-questions
broadcastEval() and Typescript
Anyways thank you a lot for the help ended a 2:30h search of pure confusion. Although i do wonder if the guild class can technically be Json serialized wouldnt the best fix be discord.js adding a proper type instead of unknown?
28 replies
DIAdiscord.js - Imagine an app
•Created by TayDex on 3/25/2024 in #djs-questions
broadcastEval() and Typescript
Okay so as like a summary for anyone who finds this in the future and as a response to you:
That is indeed the problem, although the code you have sent still give me an error and I have to type it differently:
As I want multiple things of the guild object, I'm now using this approach: :galaxybrain:
So I guess I have to pass each element individually, maybe someone knows an easier way.
Take what I say with a grain of salt, had a break from coding for a few months and just started with sharding, but the above seems to accomplish what I need without erroring.
28 replies
DIAdiscord.js - Imagine an app
•Created by TayDex on 3/25/2024 in #djs-questions
broadcastEval() and Typescript
Oh its all starting to make sense now, well its a few things like name, id, member count and maybe a few more, so I didnt want to pass each as its own context/parameter
28 replies
DIAdiscord.js - Imagine an app
•Created by TayDex on 3/25/2024 in #djs-questions
broadcastEval() and Typescript
Yeah, thanks for the attempt, my TS also seems to be insufficient, just can't believe I'm the first to get this, couldn't find anything though.
28 replies
DIAdiscord.js - Imagine an app
•Created by TayDex on 3/25/2024 in #djs-questions
broadcastEval() and Typescript
So its either Typescript complains about the function or about the use of it in broadcastEval
28 replies
DIAdiscord.js - Imagine an app
•Created by TayDex on 3/25/2024 in #djs-questions
broadcastEval() and Typescript
If I change it to:
The error immediately disappears from broadcastEval, but then I get a
Binding element 'guild' implicitly has an 'any' type.ts(7031)
on the function definition28 replies
DIAdiscord.js - Imagine an app
•Created by TayDex on 3/25/2024 in #djs-questions
broadcastEval() and Typescript
Well it's the result of multiple tries, can't find a way to get broadcastEval to be happy unless I let guild be type unkown
28 replies
DIAdiscord.js - Imagine an app
•Created by TayDex on 3/25/2024 in #djs-questions
broadcastEval() and Typescript
Comes straight from the
guildCreate
event28 replies
DIAdiscord.js - Imagine an app
•Created by TayDex on 3/25/2024 in #djs-questions
broadcastEval() and Typescript
Error here:
Removing types here will cause all the code inside to complain about implicit any type for guild.
28 replies