Skip to content

Commit

Permalink
RealtimeChannel._mode: improve typings
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonWoolf committed Jan 23, 2025
1 parent d96b1a4 commit a6fee8a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/common/lib/client/realtimechannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class RealtimeChannel extends EventEmitter {
channelSerial: string | null | undefined;
};
errorReason: ErrorInfo | string | null;
_mode?: null | number;
_mode = 0;
_attachResume: boolean;
_decodingContext: EncodingDecodingContext;
_lastPayload: {
Expand All @@ -83,7 +83,7 @@ class RealtimeChannel extends EventEmitter {
};
_allChannelChanges: EventEmitter;
params?: Record<string, any>;
modes: string[] | undefined;
modes: API.ChannelMode[] | undefined;
stateTimer?: number | NodeJS.Timeout | null;
retryTimer?: number | NodeJS.Timeout | null;
retryCount: number = 0;
Expand All @@ -106,7 +106,6 @@ class RealtimeChannel extends EventEmitter {
};
this.setOptions(options);
this.errorReason = null;
this._mode = null;
this._attachResume = false;
this._decodingContext = {
channelOptions: this.channelOptions,
Expand Down Expand Up @@ -507,7 +506,7 @@ class RealtimeChannel extends EventEmitter {
this._mode = message.getMode();
this.params = (message as any).params || {};
const modesFromFlags = message.decodeModesFromFlags();
this.modes = (modesFromFlags && Utils.allToLowerCase(modesFromFlags)) || undefined;
this.modes = (modesFromFlags && (Utils.allToLowerCase(modesFromFlags) as API.ChannelMode[])) || undefined;
const resumed = message.hasFlag('RESUMED');
const hasPresence = message.hasFlag('HAS_PRESENCE');
const hasBacklog = message.hasFlag('HAS_BACKLOG');
Expand Down

0 comments on commit a6fee8a

Please sign in to comment.