TypeScript: GuildMember#joinedTimestamp may be null. Why?

I'm converting my bot to TS, and I just noticed that GuildMember#joinedTimestamp (and GuildMember#joinedAt) are typed as possibly being null. However, on Discord's API documentation, joined_at is always present. https://discord.com/developers/docs/resources/guild#guild-member-object Why is GuildMember#joinedTimestamp possibly null? Under what circumstances might it be null? Why is this different from User#createdTimestamp ?
5 Replies
d.js toolkit
d.js toolkit7mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
OIRNOIR
OIRNOIROP7mo ago
discord.js 14.19.3 bun 1.2.13 although I don't think those are relevant to the question
Amgelo
Amgelo7mo ago
GitHub
GuildMember.joinedAt Should Not Be Nullable · Issue #3533 · disco...
Please describe the problem you are having in as much detail as possible: I was trying to use member.joinedAt but typescript said it could be null which led me to try to figure out how this could e...
Samtino
Samtino7mo ago
I don't know why/when joinedTimestamp might be null. But the difference between User#createdTimestamp and GuildMember#joinedAt is the prefix to those methods. A User is a global User irrelevant to what guilds/servers they are apart of. A GuildMember is a User in a server, which means they gave special conditions beyond a User, such as server specific name, pfp, roles, and in this example, a "joinedTimestamp" TLDR: createdTimestamp is when the account was made, joinedTimestamp is when they joined a server
OIRNOIR
OIRNOIROP7mo ago
Oh, it's specifically for guild members received in presence updates. I see. It would be understandably more complex to add an entire new cache type just for those. Thank you both.

Did you find this page helpful?