-
-
Notifications
You must be signed in to change notification settings - Fork 625
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: changing type files to declaration type files
- Loading branch information
1 parent
c134683
commit 98e6f3a
Showing
8 changed files
with
256 additions
and
346 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
98e6f3a
There was a problem hiding this comment.
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
98e6f3a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
andexecute
. Here are some test cases usingpool.query
:Promise
node-mysql2/test/tsc-build/promise/createPool/query.ts
Lines 5 to 11 in b505634
Callback
node-mysql2/test/tsc-build/mysql/createPool/callbacks/query.ts
Lines 5 to 10 in 15a8a57
Callback to Promise
node-mysql2/test/tsc-build/mysql/createPool/promise/query.ts
Lines 5 to 11 in 15a8a57
Could you show an example of when the
pool.query
wouldn't work?