diff --git a/src/transports/base.ts b/src/transports/base.ts index ba865bc..f6d775d 100644 --- a/src/transports/base.ts +++ b/src/transports/base.ts @@ -1,4 +1,4 @@ -import { Logger, Peer } from "#types.js"; +import { Logger, Peer, PeerConstructorOptions } from "#types.js"; import { URL } from "url"; import NodeId from "#nodeId.js"; @@ -8,8 +8,8 @@ export abstract class BasePeer implements Peer { challenge: Uint8Array; protected _socket: any; - constructor({ socket, uri }: { socket: any; uri: URL[] }) { - this.connectionUris = uri.map((uri) => new URL(uri.toString())); + constructor({ socket, uris }: PeerConstructorOptions) { + this.connectionUris = uris.map((uri) => new URL(uri.toString())); this.challenge = new Uint8Array(); this._socket = socket; } diff --git a/src/types.ts b/src/types.ts index cb67475..bfe03ef 100644 --- a/src/types.ts +++ b/src/types.ts @@ -30,9 +30,11 @@ export interface Peer { renderLocationUri(): string; } +export type PeerConstructorOptions = { socket: any; uris: URL[] }; + // Define the static side of the class export interface PeerStatic { - new ({ socket, uri }: { socket: any; uri: URL[] }): Peer; + new ({ socket, uris }: PeerConstructorOptions): Peer; connect(uri: URL): Promise; }