Skip to content

Commit

Permalink
fix: changing type files to declaration type files
Browse files Browse the repository at this point in the history
  • Loading branch information
wellwelwel committed Jun 26, 2023
1 parent c134683 commit 98e6f3a
Show file tree
Hide file tree
Showing 8 changed files with 256 additions and 346 deletions.
72 changes: 72 additions & 0 deletions typings/mysql/lib/protocol/sequences/ExecutableBase.d.ts
Original file line number Diff line number Diff line change
@@ -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<T extends QueryableConstructor>(
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;
104 changes: 0 additions & 104 deletions typings/mysql/lib/protocol/sequences/ExecutableBase.ts

This file was deleted.

72 changes: 72 additions & 0 deletions typings/mysql/lib/protocol/sequences/QueryableBase.d.ts
Original file line number Diff line number Diff line change
@@ -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<T extends QueryableConstructor>(
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;
104 changes: 0 additions & 104 deletions typings/mysql/lib/protocol/sequences/QueryableBase.ts

This file was deleted.

Loading

2 comments on commit 98e6f3a

@fuez96
Copy link

@fuez96 fuez96 commented on 98e6f3a Jan 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Breaking change for me on using connection pools with Typescript.
Referring to the documentation pool.query() does not exist anymore.
https://sidorares.github.io/node-mysql2/docs

@wellwelwel
Copy link
Collaborator Author

@wellwelwel wellwelwel commented on 98e6f3a Jan 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Breaking change for me on using connection pools with Typescript. Referring to the documentation pool.query() does not exist anymore. https://sidorares.github.io/node-mysql2/docs

Hi @fuez96, I don't get it. This commit just adapts the files from .ts to .d.ts.

Currently, we have a test for each variation of Pool for query and execute. Here are some test cases using pool.query:


Could you show an example of when the pool.query wouldn't work?

Please sign in to comment.