fix: change approach to make socket optional

This commit is contained in:
Derrick Hammer 2023-08-31 18:44:58 -04:00
parent 3f0b1e39a4
commit d22c757c52
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 7 additions and 3 deletions

View File

@ -3,6 +3,8 @@ import { URL } from "url";
import { Buffer } from "buffer"; import { Buffer } from "buffer";
import { Readable } from "streamx"; import { Readable } from "streamx";
type OmitSocket<T> = Omit<T, "socket">;
export default class HyperTransportPeer extends BasePeer { export default class HyperTransportPeer extends BasePeer {
private _peer: any; private _peer: any;
private _muxer: any; private _muxer: any;
@ -11,14 +13,16 @@ export default class HyperTransportPeer extends BasePeer {
private _pipe?: any; private _pipe?: any;
constructor( constructor(
options: PeerConstructorOptions & { options: OmitSocket<PeerConstructorOptions> & {
peer: any; peer: any;
muxer: any; muxer: any;
protocol: string; protocol: string;
socket?: any;
}, },
) { ) {
super(options); super({
...options,
socket: undefined,
});
const { peer, muxer, protocol } = options; const { peer, muxer, protocol } = options;
this._peer = peer; this._peer = peer;
this._muxer = muxer; this._muxer = muxer;