diff --git a/src/react-app-env.d.ts b/src/react-app-env.d.ts
index 69ee57a..5f86bb0 100644
--- a/src/react-app-env.d.ts
+++ b/src/react-app-env.d.ts
@@ -1,5 +1,71 @@
///
+// TODO: Contribute this to DefinitelyTyped
declare module 'trystero' {
- export function joinRoom(config: any, ns: any): any
+ export interface RoomConfig {}
+
+ export type PeerActionData = any
+
+ export interface Room {
+ makeAction: (
+ namespace: string
+ ) => [
+ (
+ data: PeerActionData,
+ targetPeers?: string[],
+ metadata?: Record,
+ progress: (percent: number, peerId: string) => void
+ ) => void,
+
+ (data: PeerActionData, peerId: string, metadata?: Record) => void,
+
+ (percent: number, peerId: string, metadata?: Record) => void
+ ]
+
+ ping: (id: string) => Promise
+
+ leave: () => void
+
+ getPeers: () => string[]
+
+ addStream: (
+ stream: MediaStream,
+ peerId?: string,
+ metadata?: Record
+ ) => Promise[]
+
+ removeStream: (stream: MediaStream, peerId?: string) => void
+
+ addTrack: (
+ track: MediaStreamTrack,
+ stream: MediaStream,
+ peerId?: string,
+ metadata?: Record
+ ) => Promise[]
+
+ removeTrack: (
+ track: MediaStreamTrack,
+ stream: MediaStream,
+ peerId?: string
+ ) => void
+
+ replaceTrack: (
+ oldTrack: MediaStreamTrack,
+ newTrack: MediaStreamTrack,
+ stream: MediaStream,
+ peerId?: string
+ ) => Promise[]
+
+ onPeerJoin: (fn: (peerId: string) => void) => void
+
+ onPeerLeave: (fn: (peerId: string) => void) => void
+
+ onPeerStream: (fn: (stream: MediaStream, peerId: string) => void) => void
+
+ onPeerTrack: (
+ fn: (track: MediaStreamTrack, stream: MediaStream, peerId: string) => void
+ ) => void
+ }
+
+ export function joinRoom(config: RoomConfig, roomId: string): Room
}