Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(types): correct TypeCast's Next callback to return unknown #3129

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Copy link
Collaborator

@wellwelwel wellwelwel Oct 18, 2024

Choose a reason for hiding this comment

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

No need to change the test fixtures or resources in ./website/test. They just ensure string extractions in the ExternalCodeEmbed tests and are for internal use only 🙋🏻‍♂️

*
* 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.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above.

*
* 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
Loading