@@ -8,13 +8,10 @@ const CONNECT_DISCONNECT_WARNING_THRESHOLD_MS = 400;
88const ROOM_CHANGE_WARNING_THRESHOLD_QUANTITY = 3 ;
99const ROOM_CHANGE_WARNING_THRESHOLD_MS = 1000 ;
1010
11- type RoomConnectFn = typeof Room . prototype . connect ;
12- type RoomDisconnectFn = typeof Room . prototype . disconnect ;
13-
1411/** @public */
1512export type UseSequentialRoomConnectDisconnectResults < R extends Room | undefined > = {
16- connect : R extends undefined ? RoomConnectFn | null : RoomConnectFn ;
17- disconnect : R extends undefined ? RoomDisconnectFn | null : RoomDisconnectFn ;
13+ connect : R extends undefined ? ( typeof Room . prototype . connect ) | null : ( typeof Room . prototype . connect ) ;
14+ disconnect : R extends undefined ? ( typeof Room . prototype . disconnect ) | null : ( typeof Room . prototype . disconnect ) ;
1815} ;
1916
2017/**
@@ -44,15 +41,15 @@ export function useSequentialRoomConnectDisconnect<R extends Room | undefined>(
4441 | {
4542 type : 'connect' ;
4643 room : Room ;
47- args : Parameters < RoomConnectFn > ;
48- resolve : ( value : Awaited < ReturnType < RoomConnectFn > > ) => void ;
44+ args : Parameters < ( typeof Room . prototype . connect ) > ;
45+ resolve : ( value : Awaited < ReturnType < ( typeof Room . prototype . connect ) > > ) => void ;
4946 reject : ( err : Error ) => void ;
5047 }
5148 | {
5249 type : 'disconnect' ;
5350 room : Room ;
54- args : Parameters < RoomDisconnectFn > ;
55- resolve : ( value : Awaited < ReturnType < RoomDisconnectFn > > ) => void ;
51+ args : Parameters < ( typeof Room . prototype . disconnect ) > ;
52+ resolve : ( value : Awaited < ReturnType < ( typeof Room . prototype . disconnect ) > > ) => void ;
5653 reject : ( err : Error ) => void ;
5754 }
5855 >
@@ -136,7 +133,7 @@ export function useSequentialRoomConnectDisconnect<R extends Room | undefined>(
136133 } , [ ] ) ;
137134
138135 const connect = useCallback (
139- async ( ...args : Parameters < RoomConnectFn > ) => {
136+ async ( ...args : Parameters < ( typeof Room . prototype . connect ) > ) => {
140137 return new Promise ( ( resolve , reject ) => {
141138 if ( ! room ) {
142139 throw new Error ( 'Called connect(), but room was unset' ) ;
@@ -152,7 +149,7 @@ export function useSequentialRoomConnectDisconnect<R extends Room | undefined>(
152149 ) ;
153150
154151 const disconnect = useCallback (
155- async ( ...args : Parameters < RoomDisconnectFn > ) => {
152+ async ( ...args : Parameters < ( typeof Room . prototype . disconnect ) > ) => {
156153 return new Promise ( ( resolve , reject ) => {
157154 if ( ! room ) {
158155 throw new Error ( 'Called discconnect(), but room was unset' ) ;
0 commit comments