fix: change approach to make socket optional
This commit is contained in:
parent
3f0b1e39a4
commit
d22c757c52
10
src/index.ts
10
src/index.ts
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue