Skip to content

Commit

Permalink
refactor: cleanup after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
darrachequesne committed Oct 11, 2023
1 parent f6ef267 commit 9a2a83f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 39 deletions.
9 changes: 1 addition & 8 deletions lib/namespace.ts
Expand Up @@ -662,14 +662,7 @@ export class Namespace<
*
* @param timeout
*/
public timeout(
timeout: number
): BroadcastOperator<
DecorateAcknowledgements<
DecorateAcknowledgementsWithMultipleResponses<EmitEvents>
>,
SocketData
> {
public timeout(timeout: number) {
return new BroadcastOperator<
DecorateAcknowledgementsWithMultipleResponses<EmitEvents>,
SocketData
Expand Down
48 changes: 24 additions & 24 deletions lib/typed-events.ts
Expand Up @@ -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<T> = 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<T, TypeIfAny = true, TypeIfNotAny = false> = IsAny<T> 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 unknown[]> =
ValueType extends readonly [infer ElementType]
? ElementType
Expand All @@ -284,7 +284,7 @@ export type AllButLast<T extends any[]> = T extends [...infer H, infer L]
* Like `Parameters<T>`, but doesn't require `T` to be a function ahead of time.
*/
type LooseParameters<T> = T extends (...args: infer P) => any ? P : never;
export type FirstArg<T> = T extends (arg: infer Param) => any ? Param : any;

export type FirstNonErrorArg<T> = T extends (...args: infer Params) => any
? FirstNonErrorTuple<Params>
: any;
Expand Down
14 changes: 7 additions & 7 deletions test/socket.io.test-d.ts
Expand Up @@ -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.

Expand Down

0 comments on commit 9a2a83f

Please sign in to comment.