Skip to content

Commit

Permalink
fix: type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
zaida04 committed May 29, 2024
1 parent f36bd67 commit 94292d3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/guilded.js/lib/structures/Role.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class Role extends Base<{ id: number; serverId: string }, number> {
icon: string | null;

/** The position of this role on the hierarchy */
position: number;
priority: number | null;

/** Whether this is the default role for members */
isBase: boolean;
Expand All @@ -62,7 +62,7 @@ export class Role extends Base<{ id: number; serverId: string }, number> {
this.permissions = data.permissions;
this.colors = data.colors ?? [];
this.icon = data.icon ?? null;
this.position = data.position;
this.priority = data.priority ?? null;
this.isBase = data.isBase ?? false;
this.botUserId = data.botUserId ?? null;
}
Expand Down
14 changes: 8 additions & 6 deletions packages/guilded.js/lib/structures/channels/Channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ export class Channel extends Base {
groupId: string;

/**
* Whether the channel is public.
* The visibility state of the channel.
*/
isPublic!: boolean;
visibility!: string | null;

/**
* The user ID of the user who archived the channel.
Expand All @@ -77,8 +77,9 @@ export class Channel extends Base {

constructor(
client: Client,
data: ServerChannelPayload & {
data: Omit<ServerChannelPayload, "visibility"> & {
deleted?: boolean;
visibility?: "private" | "public" | "" | null;
},
) {
super(client, data);
Expand Down Expand Up @@ -114,8 +115,9 @@ export class Channel extends Base {

_update(
data: Partial<
ServerChannelPayload & {
Omit<ServerChannelPayload, "visibility"> & {
deleted?: boolean;
visibility?: "private" | "public" | "" | null;
}
>,
): this {
Expand All @@ -139,8 +141,8 @@ export class Channel extends Base {
this.categoryId = data.categoryId ?? null;
}

if ("isPublic" in data && typeof data.isPublic !== "undefined") {
this.isPublic = data.isPublic ?? false;
if ("visibility" in data && typeof data.visibility !== "undefined") {
this.visibility = data.visibility;
}

if ("archivedBy" in data && typeof data.archivedBy !== "undefined") {
Expand Down

0 comments on commit 94292d3

Please sign in to comment.