Skip to content

Commit

Permalink
chore: fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
0t4u committed Aug 13, 2024
1 parent c5f995e commit 57e3760
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 34 deletions.
32 changes: 8 additions & 24 deletions src/Utils.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,20 @@
export type Constructor<T> = new (...args: unknown[]) => T;

export type OmitNested<I extends {}, K extends keyof I, T extends keyof NonNullable<I[K]>> = {
[key in keyof I]: key extends K ? Omit<I[key], T> : I[key];
export type OmitNested<I extends object, K extends keyof I, T extends keyof NonNullable<I[K]>> = {
[key in keyof I]: key extends K ? Omit<I[key], T> : I[key];
};

/**
* @see https://github.com/microsoft/TypeScript/issues/43505#issuecomment-1686128430
*/
export type NumericRange<
start extends number,
end extends number,
arr extends unknown[] = [],
acc extends number = never,
start extends number,
end extends number,
arr extends unknown[] = [],
acc extends number = never
> = arr['length'] extends end
? acc | start | end
: NumericRange<start, end, [...arr, 1], arr[start] extends undefined ? acc : acc | arr['length']>;

export type OmitNested<I extends {}, K extends keyof I, T extends keyof NonNullable<I[K]>> = {
[key in keyof I]: key extends K ? Omit<I[key], T> : I[key];
};

/**
* @see https://github.com/microsoft/TypeScript/issues/43505#issuecomment-1686128430
*/
export type NumericRange<
start extends number,
end extends number,
arr extends unknown[] = [],
acc extends number = never,
> = arr['length'] extends end
? acc | start | end
: NumericRange<start, end, [...arr, 1], arr[start] extends undefined ? acc : acc | arr['length']>;
? acc | start | end
: NumericRange<start, end, [...arr, 1], arr[start] extends undefined ? acc : acc | arr['length']>;

/**
* Merge the default options to user input
Expand Down
16 changes: 8 additions & 8 deletions src/node/Node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export interface Stats {
* @see https://semver.org/spec/v2.0.0.html
* @see https://lavalink.dev/api/rest.html#version-object
*/
export type NodeInfoVersion = {
export interface NodeInfoVersion {
/**
* Full version string
*/
Expand All @@ -122,13 +122,13 @@ export type NodeInfoVersion = {
* Build metadata as a dot separated list of identifiers
*/
build?: string;
};
}

/**
* Lavalink Git information
* @see https://lavalink.dev/api/rest.html#git-object
*/
export type NodeInfoGit = {
export interface NodeInfoGit {
/**
* Branch of build
*/
Expand All @@ -141,13 +141,13 @@ export type NodeInfoGit = {
* Millisecond unix timestamp for when the commit was created
*/
commitTime: number;
};
}

/**
* Lavalink plugins
* @see https://lavalink.dev/api/rest.html#plugin-object
*/
export type NodeInfoPlugin = {
export interface NodeInfoPlugin {
/**
* Name of the plugin
*/
Expand All @@ -156,13 +156,13 @@ export type NodeInfoPlugin = {
* Version of the plugin
*/
version: string;
};
}

/**
* Node information
* @see https://lavalink.dev/api/rest.html#get-lavalink-info
*/
export type NodeInfo = {
export interface NodeInfo {
/**
* Version of this Lavalink server
*/
Expand Down Expand Up @@ -195,7 +195,7 @@ export type NodeInfo = {
* Enabled plugins for this server
*/
plugins: NodeInfoPlugin[];
};
}

export interface ResumableHeaders {
[key: string]: string;
Expand Down
4 changes: 2 additions & 2 deletions src/node/Rest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export interface EmptyResult {
* Empty object
* @see https://lavalink.dev/api/rest.html#empty-result-data
*/
data: {};
data: Record<never, never>;
}

/**
Expand Down Expand Up @@ -426,7 +426,7 @@ export interface LavalinkPlayerVoice {
* Voice state of player
* @see https://lavalink.dev/api/rest.html#voice-state
*/
export interface LavalinkPlayerVoiceOptions extends Omit<LavalinkPlayerVoice, 'connected' | 'ping'> {}
export type LavalinkPlayerVoiceOptions = Omit<LavalinkPlayerVoice, 'connected' | 'ping'>;

/**
* Represents a Lavalink player
Expand Down

0 comments on commit 57e3760

Please sign in to comment.