From 9a2a83fdd42faa840d4f11fd223349e5d8e4d52c Mon Sep 17 00:00:00 2001 From: Damien Arrachequesne Date: Wed, 11 Oct 2023 10:45:59 +0200 Subject: [PATCH] refactor: cleanup after merge --- lib/namespace.ts | 9 +------- lib/typed-events.ts | 48 ++++++++++++++++++++-------------------- test/socket.io.test-d.ts | 14 ++++++------ 3 files changed, 32 insertions(+), 39 deletions(-) diff --git a/lib/namespace.ts b/lib/namespace.ts index b4d3d28ad..8e0d2d89e 100644 --- a/lib/namespace.ts +++ b/lib/namespace.ts @@ -662,14 +662,7 @@ export class Namespace< * * @param timeout */ - public timeout( - timeout: number - ): BroadcastOperator< - DecorateAcknowledgements< - DecorateAcknowledgementsWithMultipleResponses - >, - SocketData - > { + public timeout(timeout: number) { return new BroadcastOperator< DecorateAcknowledgementsWithMultipleResponses, SocketData diff --git a/lib/typed-events.ts b/lib/typed-events.ts index 19f3db6e1..19bb8702c 100644 --- a/lib/typed-events.ts +++ b/lib/typed-events.ts @@ -234,37 +234,37 @@ export abstract class StrictEventEmitter< } } /** -Returns a boolean for whether the given type is `any`. - -@link https://stackoverflow.com/a/49928360/1490091 - -Useful in type utilities, such as disallowing `any`s to be passed to a function. - -@author sindresorhus -@link https://github.com/sindresorhus/type-fest -*/ + * Returns a boolean for whether the given type is `any`. + * + * @link https://stackoverflow.com/a/49928360/1490091 + * + * Useful in type utilities, such as disallowing `any`s to be passed to a function. + * + * @author sindresorhus + * @link https://github.com/sindresorhus/type-fest + */ type IsAny = 0 extends 1 & T ? true : false; /** -An if-else-like type that resolves depending on whether the given type is `any`. - -@see {@link IsAny} - -@author sindresorhus -@link https://github.com/sindresorhus/type-fest -*/ + * An if-else-like type that resolves depending on whether the given type is `any`. + * + * @see {@link IsAny} + * + * @author sindresorhus + * @link https://github.com/sindresorhus/type-fest + */ type IfAny = IsAny extends true ? TypeIfAny : TypeIfNotAny; /** -Extracts the type of the last element of an array. - -Use-case: Defining the return type of functions that extract the last element of an array, for example [`lodash.last`](https://lodash.com/docs/4.17.15#last). - -@author sindresorhus -@link https://github.com/sindresorhus/type-fest -*/ + * Extracts the type of the last element of an array. + * + * Use-case: Defining the return type of functions that extract the last element of an array, for example [`lodash.last`](https://lodash.com/docs/4.17.15#last). + * + * @author sindresorhus + * @link https://github.com/sindresorhus/type-fest + */ export type Last = ValueType extends readonly [infer ElementType] ? ElementType @@ -284,7 +284,7 @@ export type AllButLast = T extends [...infer H, infer L] * Like `Parameters`, but doesn't require `T` to be a function ahead of time. */ type LooseParameters = T extends (...args: infer P) => any ? P : never; -export type FirstArg = T extends (arg: infer Param) => any ? Param : any; + export type FirstNonErrorArg = T extends (...args: infer Params) => any ? FirstNonErrorTuple : any; diff --git a/test/socket.io.test-d.ts b/test/socket.io.test-d.ts index d03f1af7e..1cb229cd9 100644 --- a/test/socket.io.test-d.ts +++ b/test/socket.io.test-d.ts @@ -2,13 +2,13 @@ import { createServer } from "http"; import { Adapter } from "socket.io-adapter"; import { expectType } from "tsd"; -import { BroadcastOperator, Server, Socket } from "../lib/index"; -import type { DisconnectReason } from "../lib/socket"; -import type { - DefaultEventsMap, - EventNamesWithoutAck, - EventsMap, -} from "../lib/typed-events"; +import { + BroadcastOperator, + Server, + Socket, + type DisconnectReason, +} from "../lib/index"; +import type { DefaultEventsMap, EventsMap } from "../lib/typed-events"; // This file is run by tsd, not mocha.