Skip to content

@libp2p/transport-tcp failing build with [email protected] #3368

@tabcat

Description

@tabcat
  • Version:

main branch

  • Subsystem:

@libp2p/tcp

Severity:

Failing build

Description:

> @libp2p/[email protected] build
> aegir build

[18:33:25] tsc [started]
src/listener.ts(272,19): error TS2345: Argument of type 'CancelablePromise<unknown>' is not assignable to parameter of type 'Promise<void>'.
  Types of property 'then' are incompatible.
    Type '<TResult1 = unknown, TResult2 = never>(onfulfilled?: ((value: unknown) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<...>' is not assignable to type '<TResult1 = void, TResult2 = never>(onfulfilled?: ((value: void) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<...>) | null | undefined) => Promise<...>'.
      Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible.
        Types of parameters 'value' and 'value' are incompatible.
          Type 'unknown' is not assignable to type 'void'.
src/listener.ts(285,21): error TS2345: Argument of type 'CancelablePromise<unknown>' is not assignable to parameter of type 'Promise<void>'.
  Types of property 'then' are incompatible.
    Type '<TResult1 = unknown, TResult2 = never>(onfulfilled?: ((value: unknown) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<...>' is not assignable to type '<TResult1 = void, TResult2 = never>(onfulfilled?: ((value: void) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<...>) | null | undefined) => Promise<...>'.
      Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible.
        Types of parameters 'value' and 'value' are incompatible.
          Type 'unknown' is not assignable to type 'void'.
[18:33:27] tsc [failed]
[18:33:27] → Command failed with exit code 1: tsc

Affected lines:

const events: Array<Promise<void>> = []
if (this.server.listening) {
events.push(pEvent(this.server, 'close', options))
}
// shut down the server socket, permanently
this.pause(true)
// stop any in-progress connection upgrades
this.shutdownController.abort()
// synchronously close any open connections - should be done after closing
// the server socket in case new sockets are opened during the shutdown
this.sockets.forEach(socket => {
if (socket.readable) {
events.push(pEvent(socket, 'close', options))

Previous type

pEvent<"timeout", any>(emitter: Emitter<"timeout", [any]>, event: string | symbol | ReadonlyArray<string | symbol>, options?: Options<any> | undefined): CancelablePromise<any>

7.0.2 type

pEvent<Record<string | symbol, unknown[]>, "close">(emitter: TypedEventEmitter<Record<string | symbol, unknown[]>>, event: "close", options?: Options<unknown> | undefined): CancelablePromise<unknown>

Steps to reproduce the error:

clean install and build

Metadata

Metadata

Assignees

No one assigned

    Labels

    need/triageNeeds initial labeling and prioritization

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions