Skip to content

Commit

Permalink
fix(types): correctly type Next as unknown
Browse files Browse the repository at this point in the history
Fixes typeCast Next type appears to be incorrect #3122
  • Loading branch information
bbugh committed Oct 17, 2024
1 parent b92db2a commit 5c22cf0
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion typings/mysql/lib/Connection.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export interface ConnectionOptions {
*
* You can also specify a function to do the type casting yourself:
* ```ts
* (field: Field, next: () => void) => {
* (field: Field, next: () => unknown) => {
* return next();
* }
* ```
Expand Down
2 changes: 1 addition & 1 deletion typings/mysql/lib/parsers/typeCast.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ export type Field = Type & {
geometry: () => Geometry | Geometry[] | null;
};

export type Next = () => void;
export type Next = () => unknown;

export type TypeCast = ((field: Field, next: Next) => any) | boolean;
2 changes: 1 addition & 1 deletion typings/mysql/lib/protocol/sequences/Query.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export interface QueryOptions {
*
* You can also specify a function to do the type casting yourself:
* ```ts
* (field: Field, next: () => void) => {
* (field: Field, next: () => unknown) => {
* return next();
* }
* ```
Expand Down
4 changes: 2 additions & 2 deletions website/test/fixtures/external-code-embed/QueryOptions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export interface QueryOptions {
* Determines if column values should be converted to native JavaScript types. It is not recommended (and may go away / change in the future)
* to disable type casting, but you can currently do so on either the connection or query level. (Default: true)
*
* You can also specify a function (field: any, next: () => void) => {} to do the type casting yourself.
* You can also specify a function (field: any, next: () => unknown) => {} to do the type casting yourself.
*
* WARNING: YOU MUST INVOKE the parser using one of these three field functions in your custom typeCast callback. They can only be called once.
*
Expand Down Expand Up @@ -60,4 +60,4 @@ export interface QueryOptions {
* By specifying a function that returns a readable stream, an arbitrary stream can be sent when sending a local fs file.
*/
infileStreamFactory?: (path: string) => Readable;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export interface QueryOptions {
* Determines if column values should be converted to native JavaScript types. It is not recommended (and may go away / change in the future)
* to disable type casting, but you can currently do so on either the connection or query level. (Default: true)
*
* You can also specify a function (field: any, next: () => void) => {} to do the type casting yourself.
* You can also specify a function (field: any, next: () => unknown) => {} to do the type casting yourself.
*
* WARNING: YOU MUST INVOKE the parser using one of these three field functions in your custom typeCast callback. They can only be called once.
*
Expand Down

0 comments on commit 5c22cf0

Please sign in to comment.