mirror of
https://github.com/fluencelabs/js-libp2p-interfaces
synced 2025-04-24 16:32:32 +00:00
fix: tsconfig to generate optionals correctly
This commit is contained in:
parent
f2d6a76dcf
commit
3143efd7c1
20
src/connection/connection.d.ts
vendored
20
src/connection/connection.d.ts
vendored
@ -30,8 +30,8 @@ declare class Connection {
|
||||
* @param {string} [properties.stat.encryption] connection encryption method identifier.
|
||||
*/
|
||||
constructor({ localAddr, remoteAddr, localPeer, remotePeer, newStream, close, getStreams, stat }: {
|
||||
localAddr: multiaddr;
|
||||
remoteAddr: multiaddr;
|
||||
localAddr: multiaddr | undefined;
|
||||
remoteAddr: multiaddr | undefined;
|
||||
localPeer: PeerId;
|
||||
remotePeer: PeerId;
|
||||
newStream: Function;
|
||||
@ -43,8 +43,8 @@ declare class Connection {
|
||||
open: string;
|
||||
upgraded: string;
|
||||
};
|
||||
multiplexer: string;
|
||||
encryption: string;
|
||||
multiplexer: string | undefined;
|
||||
encryption: string | undefined;
|
||||
};
|
||||
});
|
||||
/**
|
||||
@ -54,11 +54,11 @@ declare class Connection {
|
||||
/**
|
||||
* Observed multiaddr of the local peer
|
||||
*/
|
||||
localAddr: multiaddr;
|
||||
localAddr: multiaddr | undefined;
|
||||
/**
|
||||
* Observed multiaddr of the remote peer
|
||||
*/
|
||||
remoteAddr: multiaddr;
|
||||
remoteAddr: multiaddr | undefined;
|
||||
/**
|
||||
* Local peer id.
|
||||
*/
|
||||
@ -77,8 +77,8 @@ declare class Connection {
|
||||
open: string;
|
||||
upgraded: string;
|
||||
};
|
||||
multiplexer?: string;
|
||||
encryption?: string;
|
||||
multiplexer?: string | undefined;
|
||||
encryption?: string | undefined;
|
||||
};
|
||||
/**
|
||||
* Reference to the new stream function of the multiplexer
|
||||
@ -113,8 +113,8 @@ declare class Connection {
|
||||
open: string;
|
||||
upgraded: string;
|
||||
};
|
||||
multiplexer?: string;
|
||||
encryption?: string;
|
||||
multiplexer?: string | undefined;
|
||||
encryption?: string | undefined;
|
||||
};
|
||||
/**
|
||||
* Get all the streams of the muxer.
|
||||
|
14
src/pubsub/index.d.ts
vendored
14
src/pubsub/index.d.ts
vendored
@ -34,9 +34,9 @@ declare class PubsubBaseProtocol {
|
||||
globalSignaturePolicy: {
|
||||
StrictSign: "StrictSign";
|
||||
StrictNoSign: string;
|
||||
};
|
||||
canRelayMessage: boolean;
|
||||
emitSelf: boolean;
|
||||
} | undefined;
|
||||
canRelayMessage: boolean | undefined;
|
||||
emitSelf: boolean | undefined;
|
||||
});
|
||||
log: any;
|
||||
/**
|
||||
@ -285,13 +285,13 @@ declare namespace PubsubBaseProtocol {
|
||||
}
|
||||
type PeerId = import("peer-id");
|
||||
type InMessage = {
|
||||
from?: string;
|
||||
from?: string | undefined;
|
||||
receivedFrom: string;
|
||||
topicIDs: string[];
|
||||
seqno?: Uint8Array;
|
||||
seqno?: Uint8Array | undefined;
|
||||
data: Uint8Array;
|
||||
signature?: Uint8Array;
|
||||
key?: Uint8Array;
|
||||
signature?: Uint8Array | undefined;
|
||||
key?: Uint8Array | undefined;
|
||||
};
|
||||
import PeerStreams = require("./peer-streams");
|
||||
/**
|
||||
|
12
src/pubsub/utils.d.ts
vendored
12
src/pubsub/utils.d.ts
vendored
@ -3,11 +3,11 @@ export function msgId(from: string, seqno: Uint8Array): Uint8Array;
|
||||
export function noSignMsgId(data: Uint8Array): Uint8Array;
|
||||
export function anyMatch(a: Set<any> | any[], b: Set<any> | any[]): boolean;
|
||||
export function ensureArray<T>(maybeArray: T | T[]): T[];
|
||||
export function normalizeInRpcMessage<T extends unknown>(message: T, peerId?: string): T & {
|
||||
from?: string;
|
||||
peerId?: string;
|
||||
export function normalizeInRpcMessage<T extends Object>(message: T, peerId?: string | undefined): T & {
|
||||
from?: string | undefined;
|
||||
peerId?: string | undefined;
|
||||
};
|
||||
export function normalizeOutRpcMessage<T extends unknown>(message: T): T & {
|
||||
from?: Uint8Array;
|
||||
data?: Uint8Array;
|
||||
export function normalizeOutRpcMessage<T extends Object>(message: T): T & {
|
||||
from?: Uint8Array | undefined;
|
||||
data?: Uint8Array | undefined;
|
||||
};
|
||||
|
10
src/topology/index.d.ts
vendored
10
src/topology/index.d.ts
vendored
@ -17,12 +17,12 @@ declare class Topology {
|
||||
* @constructor
|
||||
*/
|
||||
constructor({ min, max, handlers }: {
|
||||
min: number;
|
||||
max: number;
|
||||
min: number | undefined;
|
||||
max: number | undefined;
|
||||
handlers: {
|
||||
onConnect: Function;
|
||||
onDisconnect: Function;
|
||||
};
|
||||
onConnect?: Function | undefined;
|
||||
onDisconnect?: Function | undefined;
|
||||
} | undefined;
|
||||
});
|
||||
min: number;
|
||||
max: number;
|
||||
|
20
src/topology/multicodec-topology.d.ts
vendored
20
src/topology/multicodec-topology.d.ts
vendored
@ -18,8 +18,8 @@ declare class MulticodecTopology extends Topology {
|
||||
* @constructor
|
||||
*/
|
||||
constructor({ min, max, multicodecs, handlers }: {
|
||||
min: number;
|
||||
max: number;
|
||||
min: number | undefined;
|
||||
max: number | undefined;
|
||||
multicodecs: Array<string>;
|
||||
handlers: {
|
||||
onConnect: Function;
|
||||
@ -34,7 +34,7 @@ declare class MulticodecTopology extends Topology {
|
||||
* @param {Array<string>} props.protocols
|
||||
*/
|
||||
_onProtocolChange({ peerId, protocols }: {
|
||||
peerId: any;
|
||||
peerId: PeerId;
|
||||
protocols: Array<string>;
|
||||
}): void;
|
||||
/**
|
||||
@ -42,18 +42,22 @@ declare class MulticodecTopology extends Topology {
|
||||
* @param {Connection} connection
|
||||
* @returns {void}
|
||||
*/
|
||||
_onPeerConnect(connection: any): void;
|
||||
_onPeerConnect(connection: Connection): void;
|
||||
/**
|
||||
* Update topology.
|
||||
* @param {Array<{id: PeerId, multiaddrs: Array<Multiaddr>, protocols: Array<string>}>} peerDataIterable
|
||||
* @returns {void}
|
||||
*/
|
||||
_updatePeers(peerDataIterable: Array<{
|
||||
id: any;
|
||||
multiaddrs: Array<any>;
|
||||
id: PeerId;
|
||||
multiaddrs: Array<Multiaddr>;
|
||||
protocols: Array<string>;
|
||||
}>): void;
|
||||
get [multicodecTopologySymbol](): boolean;
|
||||
}
|
||||
declare namespace MulticodecTopology {
|
||||
export { PeerId, Multiaddr, Connection };
|
||||
}
|
||||
import Topology = require(".");
|
||||
declare const multicodecTopologySymbol: unique symbol;
|
||||
type PeerId = import("peer-id");
|
||||
type Connection = typeof import("../connection");
|
||||
type Multiaddr = import("multiaddr");
|
||||
|
@ -6,6 +6,7 @@
|
||||
// Tells TypeScript to read JS files, as
|
||||
// normally they are ignored as source files
|
||||
"allowJs": true,
|
||||
"strict": true,
|
||||
// Generate d.ts files
|
||||
"declaration": true,
|
||||
// This compiler run should
|
||||
|
Loading…
x
Reference in New Issue
Block a user