From ba509ccd938a0e2fa954fd1dbc167f06fff6d192 Mon Sep 17 00:00:00 2001 From: Lewis Marshall Date: Fri, 11 Aug 2023 10:15:43 +0100 Subject: [PATCH] locks: Type PresenceMessage.extras Signed-off-by: Lewis Marshall --- src/Space.ts | 6 +++--- src/utilities/types.d.ts | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Space.ts b/src/Space.ts index fa31511e..9962b23c 100644 --- a/src/Space.ts +++ b/src/Space.ts @@ -58,21 +58,21 @@ class Space extends EventEmitter { this.locks = new Locks(this, this.presenceUpdate); } - private presenceUpdate = (data: PresenceMember['data'], extras?: any) => { + private presenceUpdate = (data: PresenceMember['data'], extras?: PresenceMember['extras']) => { if (!extras) { return this.channel.presence.update(data); } return this.channel.presence.update(Ably.Realtime.PresenceMessage.fromValues({ data, extras })); }; - private presenceEnter = (data: PresenceMember['data'], extras?: any) => { + private presenceEnter = (data: PresenceMember['data'], extras?: PresenceMember['extras']) => { if (!extras) { return this.channel.presence.enter(data); } return this.channel.presence.enter(Ably.Realtime.PresenceMessage.fromValues({ data, extras })); }; - private presenceLeave = (data: PresenceMember['data'], extras?: any) => { + private presenceLeave = (data: PresenceMember['data'], extras?: PresenceMember['extras']) => { if (!extras) { return this.channel.presence.leave(data); } diff --git a/src/utilities/types.d.ts b/src/utilities/types.d.ts index 58f6ce2f..f5f9c5f3 100644 --- a/src/utilities/types.d.ts +++ b/src/utilities/types.d.ts @@ -2,6 +2,7 @@ import { Types } from 'ably'; import { EventKey, EventListener, EventMap } from './EventEmitter.js'; import { ProfileData } from '../types.js'; +import { LockRequest } from '../Locks.js'; export type PresenceMember = { data: { @@ -15,6 +16,9 @@ export type PresenceMember = { current: unknown; }; }; + extras?: { + locks: LockRequest[]; + }; } & Omit; export type Subset = {