Skip to content

docs: describe private properties #8879

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 1, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/discord.js/src/managers/CachedManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ class CachedManager extends DataManager {
constructor(client, holds, iterable) {
super(client, holds);

/**
* The private cache of items for this manager.
* @type {Collection}
* @private
* @readonly
* @name CachedManager#_cache
*/
Object.defineProperty(this, '_cache', { value: this.client.options.makeCache(this.constructor, this.holds) });

if (iterable) {
Expand Down
5 changes: 5 additions & 0 deletions packages/discord.js/src/structures/GuildMember.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ class GuildMember extends Base {
*/
this.communicationDisabledUntilTimestamp = null;

/**
* The role ids of the member
* @type {Snowflake[]}
* @private
*/
this._roles = [];
if (data) this._patch(data);
}
Expand Down
12 changes: 12 additions & 0 deletions packages/discord.js/src/structures/Presence.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ class Presence extends Base {
*/
class Activity {
constructor(presence, data) {
/**
* The presence of the Activity
* @type {Presence}
* @readonly
* @name Activity#presence
*/
Object.defineProperty(this, 'presence', { value: presence });

/**
Expand Down Expand Up @@ -285,6 +291,12 @@ class Activity {
*/
class RichPresenceAssets {
constructor(activity, assets) {
/**
* The activity of the RichPresenceAssets
* @type {Activity}
* @readonly
* @name RichPresenceAssets#activity
*/
Object.defineProperty(this, 'activity', { value: activity });

/**
Expand Down
4 changes: 4 additions & 0 deletions packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ declare module 'node:events' {

export class Activity {
private constructor(presence: Presence, data?: RawActivityData);
public readonly presence: Presence;
public applicationId: Snowflake | null;
public assets: RichPresenceAssets | null;
public buttons: string[];
Expand Down Expand Up @@ -1417,6 +1418,7 @@ export class GuildEmoji extends BaseGuildEmoji {

export class GuildMember extends PartialTextBasedChannel(Base) {
private constructor(client: Client<true>, data: RawGuildMemberData, guild: Guild);
private _roles: Snowflake[];
public avatar: string | null;
public get bannable(): boolean;
public get dmChannel(): DMChannel | null;
Expand Down Expand Up @@ -2348,6 +2350,7 @@ export class ReactionEmoji extends Emoji {

export class RichPresenceAssets {
private constructor(activity: Activity, assets: RawRichPresenceAssets);
public readonly activity: Activity;
public largeImage: Snowflake | null;
public largeText: string | null;
public smallImage: Snowflake | null;
Expand Down Expand Up @@ -3577,6 +3580,7 @@ export abstract class DataManager<K, Holds, R> extends BaseManager {

export abstract class CachedManager<K, Holds, R> extends DataManager<K, Holds, R> {
protected constructor(client: Client<true>, holds: Constructable<Holds>);
private readonly _cache: Collection<K, Holds>;
private _add(data: unknown, cache?: boolean, { id, extras }?: { id: K; extras: unknown[] }): Holds;
}

Expand Down