From 98e6f3a0b1f2d523dc8cb62c67e49d9589c469eb Mon Sep 17 00:00:00 2001 From: wellwelwel <46850407+wellwelwel@users.noreply.github.com> Date: Mon, 26 Jun 2023 03:14:38 -0300 Subject: [PATCH] fix: changing type files to declaration type files --- .../protocol/sequences/ExecutableBase.d.ts | 72 ++++++++++++ .../lib/protocol/sequences/ExecutableBase.ts | 104 ------------------ .../lib/protocol/sequences/QueryableBase.d.ts | 72 ++++++++++++ .../lib/protocol/sequences/QueryableBase.ts | 104 ------------------ .../sequences/promise/ExecutableBase.d.ts | 56 ++++++++++ .../sequences/promise/ExecutableBase.ts | 69 ------------ .../sequences/promise/QueryableBase.d.ts | 56 ++++++++++ .../sequences/promise/QueryableBase.ts | 69 ------------ 8 files changed, 256 insertions(+), 346 deletions(-) create mode 100644 typings/mysql/lib/protocol/sequences/ExecutableBase.d.ts delete mode 100644 typings/mysql/lib/protocol/sequences/ExecutableBase.ts create mode 100644 typings/mysql/lib/protocol/sequences/QueryableBase.d.ts delete mode 100644 typings/mysql/lib/protocol/sequences/QueryableBase.ts create mode 100644 typings/mysql/lib/protocol/sequences/promise/ExecutableBase.d.ts delete mode 100644 typings/mysql/lib/protocol/sequences/promise/ExecutableBase.ts create mode 100644 typings/mysql/lib/protocol/sequences/promise/QueryableBase.d.ts delete mode 100644 typings/mysql/lib/protocol/sequences/promise/QueryableBase.ts diff --git a/typings/mysql/lib/protocol/sequences/ExecutableBase.d.ts b/typings/mysql/lib/protocol/sequences/ExecutableBase.d.ts new file mode 100644 index 0000000000..c39f87c0b9 --- /dev/null +++ b/typings/mysql/lib/protocol/sequences/ExecutableBase.d.ts @@ -0,0 +1,72 @@ +import { + OkPacket, + FieldPacket, + RowDataPacket, + ResultSetHeader, +} from '../packets/index.js'; +import { + Query, + QueryError, + QueryOptions, + QueryableConstructor, +} from './Query.js'; +export declare function ExecutableBase( + Base?: T +): { + new (...args: any[]): { + execute< + T extends + | OkPacket + | ResultSetHeader + | RowDataPacket[] + | RowDataPacket[][] + | OkPacket[] + >( + sql: string, + callback?: + | ((err: QueryError | null, result: T, fields: FieldPacket[]) => any) + | undefined + ): Query; + execute< + T_1 extends + | OkPacket + | ResultSetHeader + | RowDataPacket[] + | RowDataPacket[][] + | OkPacket[] + >( + sql: string, + values: any, + callback?: + | ((err: QueryError | null, result: T_1, fields: FieldPacket[]) => any) + | undefined + ): Query; + execute< + T_2 extends + | OkPacket + | ResultSetHeader + | RowDataPacket[] + | RowDataPacket[][] + | OkPacket[] + >( + options: QueryOptions, + callback?: + | ((err: QueryError | null, result: T_2, fields?: FieldPacket[]) => any) + | undefined + ): Query; + execute< + T_3 extends + | OkPacket + | ResultSetHeader + | RowDataPacket[] + | RowDataPacket[][] + | OkPacket[] + >( + options: QueryOptions, + values: any, + callback?: + | ((err: QueryError | null, result: T_3, fields: FieldPacket[]) => any) + | undefined + ): Query; + }; +} & T; diff --git a/typings/mysql/lib/protocol/sequences/ExecutableBase.ts b/typings/mysql/lib/protocol/sequences/ExecutableBase.ts deleted file mode 100644 index 237f7dd110..0000000000 --- a/typings/mysql/lib/protocol/sequences/ExecutableBase.ts +++ /dev/null @@ -1,104 +0,0 @@ -import { - OkPacket, - FieldPacket, - RowDataPacket, - ResultSetHeader, -} from '../packets/index.js'; -import { - Query, - QueryError, - QueryOptions, - QueryableConstructor, -} from './Query.js'; - -export function ExecutableBase( - Base: T = {} as T -) { - return class extends Base { - execute< - T extends - | RowDataPacket[][] - | RowDataPacket[] - | OkPacket - | OkPacket[] - | ResultSetHeader - >( - sql: string, - callback?: ( - err: QueryError | null, - result: T, - fields: FieldPacket[] - ) => any - ): Query; - execute< - T extends - | RowDataPacket[][] - | RowDataPacket[] - | OkPacket - | OkPacket[] - | ResultSetHeader - >( - sql: string, - values: any | any[] | { [param: string]: any }, - callback?: ( - err: QueryError | null, - result: T, - fields: FieldPacket[] - ) => any - ): Query; - execute< - T extends - | RowDataPacket[][] - | RowDataPacket[] - | OkPacket - | OkPacket[] - | ResultSetHeader - >( - options: QueryOptions, - callback?: ( - err: QueryError | null, - result: T, - fields?: FieldPacket[] - ) => any - ): Query; - execute< - T extends - | RowDataPacket[][] - | RowDataPacket[] - | OkPacket - | OkPacket[] - | ResultSetHeader - >( - options: QueryOptions, - values: any | any[] | { [param: string]: any }, - callback?: ( - err: QueryError | null, - result: T, - fields: FieldPacket[] - ) => any - ): Query; - - // Implementing all overload variations - /* eslint-disable @typescript-eslint/no-unused-vars */ - execute( - options: QueryOptions | string, - values?: - | any - | any[] - | { [param: string]: any } - | (( - err: QueryError | null, - result: any, - fields?: FieldPacket[] - ) => any), - callback?: ( - err: QueryError | null, - result: any, - fields: FieldPacket[] - ) => any - ): Query { - return new Query(); - } - /* eslint-enable @typescript-eslint/no-unused-vars */ - }; -} diff --git a/typings/mysql/lib/protocol/sequences/QueryableBase.d.ts b/typings/mysql/lib/protocol/sequences/QueryableBase.d.ts new file mode 100644 index 0000000000..c5c3857486 --- /dev/null +++ b/typings/mysql/lib/protocol/sequences/QueryableBase.d.ts @@ -0,0 +1,72 @@ +import { + OkPacket, + FieldPacket, + RowDataPacket, + ResultSetHeader, +} from '../packets/index.js'; +import { + Query, + QueryError, + QueryOptions, + QueryableConstructor, +} from './Query.js'; +export declare function QueryableBase( + Base?: T +): { + new (...args: any[]): { + query< + T extends + | OkPacket + | ResultSetHeader + | RowDataPacket[] + | RowDataPacket[][] + | OkPacket[] + >( + sql: string, + callback?: + | ((err: QueryError | null, result: T, fields: FieldPacket[]) => any) + | undefined + ): Query; + query< + T_1 extends + | OkPacket + | ResultSetHeader + | RowDataPacket[] + | RowDataPacket[][] + | OkPacket[] + >( + sql: string, + values: any, + callback?: + | ((err: QueryError | null, result: T_1, fields: FieldPacket[]) => any) + | undefined + ): Query; + query< + T_2 extends + | OkPacket + | ResultSetHeader + | RowDataPacket[] + | RowDataPacket[][] + | OkPacket[] + >( + options: QueryOptions, + callback?: + | ((err: QueryError | null, result: T_2, fields?: FieldPacket[]) => any) + | undefined + ): Query; + query< + T_3 extends + | OkPacket + | ResultSetHeader + | RowDataPacket[] + | RowDataPacket[][] + | OkPacket[] + >( + options: QueryOptions, + values: any, + callback?: + | ((err: QueryError | null, result: T_3, fields: FieldPacket[]) => any) + | undefined + ): Query; + }; +} & T; diff --git a/typings/mysql/lib/protocol/sequences/QueryableBase.ts b/typings/mysql/lib/protocol/sequences/QueryableBase.ts deleted file mode 100644 index 1572ed4fdc..0000000000 --- a/typings/mysql/lib/protocol/sequences/QueryableBase.ts +++ /dev/null @@ -1,104 +0,0 @@ -import { - OkPacket, - FieldPacket, - RowDataPacket, - ResultSetHeader, -} from '../packets/index.js'; -import { - Query, - QueryError, - QueryOptions, - QueryableConstructor, -} from './Query.js'; - -export function QueryableBase( - Base: T = {} as T -) { - return class extends Base { - query< - T extends - | RowDataPacket[][] - | RowDataPacket[] - | OkPacket - | OkPacket[] - | ResultSetHeader - >( - sql: string, - callback?: ( - err: QueryError | null, - result: T, - fields: FieldPacket[] - ) => any - ): Query; - query< - T extends - | RowDataPacket[][] - | RowDataPacket[] - | OkPacket - | OkPacket[] - | ResultSetHeader - >( - sql: string, - values: any | any[] | { [param: string]: any }, - callback?: ( - err: QueryError | null, - result: T, - fields: FieldPacket[] - ) => any - ): Query; - query< - T extends - | RowDataPacket[][] - | RowDataPacket[] - | OkPacket - | OkPacket[] - | ResultSetHeader - >( - options: QueryOptions, - callback?: ( - err: QueryError | null, - result: T, - fields?: FieldPacket[] - ) => any - ): Query; - query< - T extends - | RowDataPacket[][] - | RowDataPacket[] - | OkPacket - | OkPacket[] - | ResultSetHeader - >( - options: QueryOptions, - values: any | any[] | { [param: string]: any }, - callback?: ( - err: QueryError | null, - result: T, - fields: FieldPacket[] - ) => any - ): Query; - - // Implementing all overload variations - /* eslint-disable @typescript-eslint/no-unused-vars */ - query( - options: QueryOptions | string, - values?: - | any - | any[] - | { [param: string]: any } - | (( - err: QueryError | null, - result: any, - fields?: FieldPacket[] - ) => any), - callback?: ( - err: QueryError | null, - result: any, - fields: FieldPacket[] - ) => any - ): Query { - return new Query(); - } - /* eslint-enable @typescript-eslint/no-unused-vars */ - }; -} diff --git a/typings/mysql/lib/protocol/sequences/promise/ExecutableBase.d.ts b/typings/mysql/lib/protocol/sequences/promise/ExecutableBase.d.ts new file mode 100644 index 0000000000..07aa08ba4e --- /dev/null +++ b/typings/mysql/lib/protocol/sequences/promise/ExecutableBase.d.ts @@ -0,0 +1,56 @@ +import { + OkPacket, + FieldPacket, + RowDataPacket, + ResultSetHeader, +} from '../../packets/index.js'; +import { QueryOptions, QueryableConstructor } from '../Query.js'; + +export declare function ExecutableBase( + Base?: T +): { + new (...args: any[]): { + execute< + T extends + | OkPacket + | ResultSetHeader + | RowDataPacket[] + | RowDataPacket[][] + | OkPacket[] + >( + sql: string + ): Promise<[T, FieldPacket[]]>; + execute< + T_1 extends + | OkPacket + | ResultSetHeader + | RowDataPacket[] + | RowDataPacket[][] + | OkPacket[] + >( + sql: string, + values: any + ): Promise<[T_1, FieldPacket[]]>; + execute< + T_2 extends + | OkPacket + | ResultSetHeader + | RowDataPacket[] + | RowDataPacket[][] + | OkPacket[] + >( + options: QueryOptions + ): Promise<[T_2, FieldPacket[]]>; + execute< + T_3 extends + | OkPacket + | ResultSetHeader + | RowDataPacket[] + | RowDataPacket[][] + | OkPacket[] + >( + options: QueryOptions, + values: any + ): Promise<[T_3, FieldPacket[]]>; + }; +} & T; diff --git a/typings/mysql/lib/protocol/sequences/promise/ExecutableBase.ts b/typings/mysql/lib/protocol/sequences/promise/ExecutableBase.ts deleted file mode 100644 index 98efdb5603..0000000000 --- a/typings/mysql/lib/protocol/sequences/promise/ExecutableBase.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { - OkPacket, - FieldPacket, - RowDataPacket, - ResultSetHeader, -} from '../../packets/index.js'; -import { Query, QueryOptions, QueryableConstructor } from '../Query.js'; - -export function ExecutableBase( - Base: T = {} as T -) { - return class extends Base { - execute< - T extends - | RowDataPacket[][] - | RowDataPacket[] - | OkPacket - | OkPacket[] - | ResultSetHeader - >(sql: string): Promise<[T, FieldPacket[]]>; - execute< - T extends - | RowDataPacket[][] - | RowDataPacket[] - | OkPacket - | OkPacket[] - | ResultSetHeader - >( - sql: string, - values: any | any[] | { [param: string]: any } - ): Promise<[T, FieldPacket[]]>; - execute< - T extends - | RowDataPacket[][] - | RowDataPacket[] - | OkPacket - | OkPacket[] - | ResultSetHeader - >(options: QueryOptions): Promise<[T, FieldPacket[]]>; - execute< - T extends - | RowDataPacket[][] - | RowDataPacket[] - | OkPacket - | OkPacket[] - | ResultSetHeader - >( - options: QueryOptions, - values: any | any[] | { [param: string]: any } - ): Promise<[T, FieldPacket[]]>; - - // Implementing all overload variations - /* eslint-disable @typescript-eslint/no-unused-vars */ - execute< - T extends - | RowDataPacket[][] - | RowDataPacket[] - | OkPacket - | OkPacket[] - | ResultSetHeader - >( - sql: string | QueryOptions, - values?: any | any[] | { [param: string]: any } - ): Promise<[T, FieldPacket[]]> { - return new Promise(() => new Query()); - } - /* eslint-enable @typescript-eslint/no-unused-vars */ - }; -} diff --git a/typings/mysql/lib/protocol/sequences/promise/QueryableBase.d.ts b/typings/mysql/lib/protocol/sequences/promise/QueryableBase.d.ts new file mode 100644 index 0000000000..b10f68f510 --- /dev/null +++ b/typings/mysql/lib/protocol/sequences/promise/QueryableBase.d.ts @@ -0,0 +1,56 @@ +import { + OkPacket, + FieldPacket, + RowDataPacket, + ResultSetHeader, +} from '../../packets/index.js'; +import { QueryOptions, QueryableConstructor } from '../Query.js'; + +export declare function QueryableBase( + Base?: T +): { + new (...args: any[]): { + query< + T extends + | OkPacket + | ResultSetHeader + | RowDataPacket[] + | RowDataPacket[][] + | OkPacket[] + >( + sql: string + ): Promise<[T, FieldPacket[]]>; + query< + T_1 extends + | OkPacket + | ResultSetHeader + | RowDataPacket[] + | RowDataPacket[][] + | OkPacket[] + >( + sql: string, + values: any + ): Promise<[T_1, FieldPacket[]]>; + query< + T_2 extends + | OkPacket + | ResultSetHeader + | RowDataPacket[] + | RowDataPacket[][] + | OkPacket[] + >( + options: QueryOptions + ): Promise<[T_2, FieldPacket[]]>; + query< + T_3 extends + | OkPacket + | ResultSetHeader + | RowDataPacket[] + | RowDataPacket[][] + | OkPacket[] + >( + options: QueryOptions, + values: any + ): Promise<[T_3, FieldPacket[]]>; + }; +} & T; diff --git a/typings/mysql/lib/protocol/sequences/promise/QueryableBase.ts b/typings/mysql/lib/protocol/sequences/promise/QueryableBase.ts deleted file mode 100644 index 357c28e3bf..0000000000 --- a/typings/mysql/lib/protocol/sequences/promise/QueryableBase.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { - OkPacket, - FieldPacket, - RowDataPacket, - ResultSetHeader, -} from '../../packets/index.js'; -import { Query, QueryOptions, QueryableConstructor } from '../Query.js'; - -export function QueryableBase( - Base: T = {} as T -) { - return class extends Base { - query< - T extends - | RowDataPacket[][] - | RowDataPacket[] - | OkPacket - | OkPacket[] - | ResultSetHeader - >(sql: string): Promise<[T, FieldPacket[]]>; - query< - T extends - | RowDataPacket[][] - | RowDataPacket[] - | OkPacket - | OkPacket[] - | ResultSetHeader - >( - sql: string, - values: any | any[] | { [param: string]: any } - ): Promise<[T, FieldPacket[]]>; - query< - T extends - | RowDataPacket[][] - | RowDataPacket[] - | OkPacket - | OkPacket[] - | ResultSetHeader - >(options: QueryOptions): Promise<[T, FieldPacket[]]>; - query< - T extends - | RowDataPacket[][] - | RowDataPacket[] - | OkPacket - | OkPacket[] - | ResultSetHeader - >( - options: QueryOptions, - values: any | any[] | { [param: string]: any } - ): Promise<[T, FieldPacket[]]>; - - // Implementing all overload variations - /* eslint-disable @typescript-eslint/no-unused-vars */ - query< - T extends - | RowDataPacket[][] - | RowDataPacket[] - | OkPacket - | OkPacket[] - | ResultSetHeader - >( - sql: string | QueryOptions, - values?: any | any[] | { [param: string]: any } - ): Promise<[T, FieldPacket[]]> { - return new Promise(() => new Query()); - } - /* eslint-enable @typescript-eslint/no-unused-vars */ - }; -}