Elliot
SIASapphire - Imagine a framework
•Created by Elliot on 9/8/2023 in #discordjs-support
How do you handle incompatible null/undefined from discord.js typings?
Note: This is not a typescript problem, I know how to solve it from different ways. I'm just looking for feedbacks or djs-specific answers/workarounds
There are a lot of places where
discord.js
uses a mix of null/undefined and sometimes it gets really frustrating. For example this is a very common occurence in my codebase :
This leads to a type mismatch which triggers typescript.
Is it expected that types within a single library don't match like this?
How do you handle this in your discord.js codebase? I'm tired of adding ?? undefined
(which makes no sense) or a TS null assertion !
…
Thank you!
(PS: you should update the djs versions in the tags)16 replies
SIASapphire - Imagine a framework
•Created by Elliot on 4/16/2023 in #sapphire-support
More information for CombinedPropertyErrors on shapeshift
Hello, I just rountinely cheked my errors on my production bot and noticed that a few days ago I had the following error
Is it expected that i don't have more information on the error ? Because if I understand correctly here the error is just telling me "there was errors", but not telling me which...
Is there anything to enable in shapeshift or the logger (object depth?) or idk to have more informations in the future?
Because I can't do much with such an unhelpful error
btw it happened with the following code, so my guess is that the pupa thing or my contentValue exceeded the field value max length, but i'd have liked the shapeshift error to tell me that..
Thanks :)
7 replies
SIASapphire - Imagine a framework
•Created by Elliot on 2/28/2023 in #sapphire-support
Version mismatch between Sapphire and dapi-types
Hi, I was updating my dependencies when I encountered Discord.js' dapi-types error.
I copy/pasted their solution in my package.json (https://discord.com/channels/222078108977594368/769862166131245066/1076213839990894604)
Which fixed all the Typescript's compilation errors.
But now I have a runtime error with Sapphire failing to resolve dapi-types :
Versions of relevant deps (everything is latest from NPM) :
What should I do to fix this runtime error ? 😄
Thanks
13 replies
SIASapphire - Imagine a framework
•Created by Elliot on 1/12/2023 in #discordjs-support
BaseMessageOptions#components does not take Builders
Hey everyone, so I've just downloaded djs 14.7.0 and i'm migrating my bot.
I used to have a few
.send({ components: [myComp] })
, where myComp
was the equivalent of what is now a Builder. So now i've updated it to a builder, but it is no longer accepted by TypeScript. A few examples:
How can I solve this?
Calling .data or .toJSON() does not solve the issue
Thanks!6 replies