Skip to content

Commit 7f7ec82

Browse files
authored
fix: export transiently referenced types (#2717)
When we export a function like: ```ts export function (foo: Bar): Baz { return { ... } } ``` We have to also export the `Bar` type and any types it references, otherwise typedoc cannot create the API docs for us. Also swaps instances of `(default: foo)` to use `@default` jsdoc tags.
1 parent abc7e66 commit 7f7ec82

File tree

60 files changed

+412
-214
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+412
-214
lines changed

packages/crypto/src/keys/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
/**
22
* @packageDocumentation
33
*
4-
* **Supported Key Types**
5-
*
6-
* The {@link generateKeyPair}, {@link marshalPublicKey}, and {@link marshalPrivateKey} functions accept a string `type` argument.
4+
* ## Supported Key Types
75
*
86
* Currently the `'RSA'`, `'ed25519'`, and `secp256k1` types are supported, although ed25519 and secp256k1 keys support only signing and verification of messages.
97
*
@@ -19,6 +17,8 @@ import type { PrivateKey, PublicKey, KeyType, RSAPrivateKey, Secp256k1PrivateKey
1917
import type { MultihashDigest } from 'multiformats'
2018

2119
export { generateEphemeralKeyPair } from './ecdh/index.js'
20+
export type { Curve } from './ecdh/index.js'
21+
export type { ECDHKey, EnhancedKey, EnhancedKeyPair, ECDHKeyPair } from './interface.js'
2222
export { keyStretcher } from './key-stretcher.js'
2323

2424
/**

packages/interface-compliance-tests/src/mocks/connection-manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export interface MockNetworkComponents {
1616
logger: ComponentLogger
1717
}
1818

19-
class MockNetwork {
19+
export class MockNetwork {
2020
private components: MockNetworkComponents[] = []
2121

2222
addNode (components: MockNetworkComponents): void {

packages/interface-compliance-tests/src/mocks/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ export { mockUpgrader } from './upgrader.js'
88
export { mockDuplex } from './duplex.js'
99
export { mockMetrics } from './metrics.js'
1010
export type { MockUpgraderInit } from './upgrader.js'
11-
export type { MockNetworkComponents } from './connection-manager.js'
11+
export type { MockNetworkComponents, MockConnectionManagerComponents, MockNetwork } from './connection-manager.js'
12+
export type { MockConnectionOptions, StreamInit, StreamPairInit } from './connection.js'
13+
export type { MockMultiaddrConnPairOptions } from './multiaddr-connection.js'

packages/interface-compliance-tests/src/mocks/muxer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,6 @@ class MockMuxerFactory implements StreamMuxerFactory {
309309
}
310310
}
311311

312-
export function mockMuxer (): MockMuxerFactory {
312+
export function mockMuxer (): StreamMuxerFactory {
313313
return new MockMuxerFactory()
314314
}

packages/interface-compliance-tests/typedoc.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"./src/matchers.ts",
88
"./src/mocks/index.ts",
99
"./src/peer-discovery/index.ts",
10-
"./src/peers.ts",
1110
"./src/pubsub/index.ts",
1211
"./src/stream-muxer/index.ts",
1312
"./src/transport/index.ts"

packages/interface-internal/src/connection-manager/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,18 @@ import type { ProgressOptions } from 'progress-events'
66
export interface OpenConnectionOptions extends AbortOptions, ProgressOptions<OpenConnectionProgressEvents> {
77
/**
88
* Connection requests with a higher priority will be executed before those
9-
* with a lower priority. (default: 50)
9+
* with a lower priority.
10+
*
11+
* @default 50
1012
*/
1113
priority?: number
1214

1315
/**
1416
* When opening a connection to a remote peer, if a connection already exists
1517
* it will be returned instead of creating a new connection. Pass true here
16-
* to override that and dial a new connection anyway. (default: false)
18+
* to override that and dial a new connection anyway.
19+
*
20+
* @default false
1721
*/
1822
force?: boolean
1923
}

packages/interface-internal/src/registrar/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,16 @@ export interface StreamHandler {
1818

1919
export interface StreamHandlerOptions {
2020
/**
21-
* How many incoming streams can be open for this protocol at the same time on each connection (default: 32)
21+
* How many incoming streams can be open for this protocol at the same time on each connection
22+
*
23+
* @default 32
2224
*/
2325
maxInboundStreams?: number
2426

2527
/**
26-
* How many outgoing streams can be open for this protocol at the same time on each connection (default: 64)
28+
* How many outgoing streams can be open for this protocol at the same time on each connection
29+
*
30+
* @default 64
2731
*/
2832
maxOutboundStreams?: number
2933

packages/interface/src/connection/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export interface Stream extends Duplex<AsyncGenerator<Uint8ArrayList>, Source<Ui
126126
*
127127
* This will cause a `RESET` message to be sent to the remote, *unless* the sink has already ended.
128128
*
129-
* The sink will return and the source will throw if an error is passed or return normally if not.
129+
* The sink will return and the source will throw.
130130
*/
131131
abort(err: Error): void
132132

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
/** Noop for browser compatibility */
1+
/**
2+
* Noop for browser compatibility
3+
*/
24
export function setMaxListeners (): void {}

packages/interface/src/events.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { setMaxListeners as nodeSetMaxListeners } from 'events'
22

3-
// create a setMaxListeners that doesn't break browser usage
3+
/**
4+
* Create a setMaxListeners that doesn't break browser usage
5+
*/
46
export const setMaxListeners: typeof nodeSetMaxListeners = (n, ...eventTargets) => {
57
try {
68
nodeSetMaxListeners(n, ...eventTargets)

0 commit comments

Comments
 (0)