discord-api-types APIGuildMember no permissions bit field?

Shouldn't APIGuildMember ( https://discord-api-types.dev/api/discord-api-types-v10/interface/APIGuildMember ) include permissions, just like GuildMember ( https://discord.com/developers/docs/resources/guild#guild-member-object )? I'm using the "@discordjs/rest" and "discord-api-types" npm packages in my app (written in typescript) and am trying to check if a user has certain permissions, but the Type doesn't have the permission field. Also there's basicly no examples of how to use the "@discordjs/rest" package. The only examples are here and they only show post, not get! Simplified example of what I'm trying to do...
import { REST } from "@discordjs/rest";
import { Routes, type APIGuildMember } from "discord-api-types/v10";

const rest = new REST({ version: "10" }).setToken("Imagine I put a valid token here lol");

const member = await rest.get(Routes.guildMember("a valid guild id", "a valid user id"));
member.permissions // Property 'permissions' does not exist on type '{}'.ts(2339)
import { REST } from "@discordjs/rest";
import { Routes, type APIGuildMember } from "discord-api-types/v10";

const rest = new REST({ version: "10" }).setToken("Imagine I put a valid token here lol");

const member = await rest.get(Routes.guildMember("a valid guild id", "a valid user id"));
member.permissions // Property 'permissions' does not exist on type '{}'.ts(2339)
rest.get() returns a Promise<unknown>, so what am I gonna do with that in typescript? If I use as APIGuildMember | null technically typescript has no problem with it, but as soon as I'm trying to use the .permission typescript's gonna cry that APIGuildMember doesn't have the property permissions. So, am I using the rest.get() in an unsupported way, or am I just not supposed to do permission stuff with these libraries, or is APIGuildMember.permissions actually just missing accidentally and will be added?
1 Reply
d.js toolkit
d.js toolkit14mo 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
Want results from more Discord servers?
Add your server