From 81be01b1bce30cac3f6fcc130aaf859349c5d3d2 Mon Sep 17 00:00:00 2001 From: Scraps <123112608+ScrapsPrograms@users.noreply.github.com> Date: Sat, 14 Sep 2024 04:17:36 +0200 Subject: [PATCH] fix(typings): synchronize types of sqlstring (#3047) * fix: Export types directly from sqlstring dependency Signed-off-by: Scraps <123112608+ScrapsPrograms@users.noreply.github.com> * Revert "fix: Export types directly from sqlstring dependency" This reverts commit f489a978e2c4ea41b94eecc68930ca94f1acbfda. * refactor: Merged similarly shaped format overloads Signed-off-by: Scraps <123112608+ScrapsPrograms@users.noreply.github.com> * fix: Added "hidden" type definitions provided by sqlstring package Signed-off-by: Scraps <123112608+ScrapsPrograms@users.noreply.github.com> * Added header comments Signed-off-by: Scraps <123112608+ScrapsPrograms@users.noreply.github.com> * refactor: moved header comment Signed-off-by: Scraps <123112608+ScrapsPrograms@users.noreply.github.com> * refactor: typing corrections Signed-off-by: Scraps <123112608+ScrapsPrograms@users.noreply.github.com> * fix: Ran prettier Signed-off-by: Scraps <123112608+ScrapsPrograms@users.noreply.github.com> --------- Signed-off-by: Scraps <123112608+ScrapsPrograms@users.noreply.github.com> --- typings/mysql/index.d.ts | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/typings/mysql/index.d.ts b/typings/mysql/index.d.ts index 7dafa9cbf3..3ef9b6b464 100644 --- a/typings/mysql/index.d.ts +++ b/typings/mysql/index.d.ts @@ -1,3 +1,6 @@ +/** + * sqlstring types are based on https://www.npmjs.com/package/@types/sqlstring, version 2.3.2 + */ import { Pool as BasePool, PoolOptions } from './lib/Pool.js'; import { Connection as BaseConnection, @@ -53,23 +56,21 @@ export function createPool(config: PoolOptions): BasePool; export function createPoolCluster(config?: PoolClusterOptions): PoolCluster; -export function escape(value: any): string; - -export function escapeId(value: any): string; - -export function format(sql: string): string; -export function format( - sql: string, - values: any[], +type TimeZone = 'local' | 'Z' | (string & NonNullable); +export function escape( + value: any, stringifyObjects?: boolean, - timeZone?: string, + timeZone?: TimeZone, ): string; +export function escapeId(value: any, forbidQualified?: boolean): string; + +export function format(sql: string): string; export function format( sql: string, - values: any, + values: any | any[], stringifyObjects?: boolean, - timeZone?: string, + timeZone?: TimeZone, ): string; export function raw(sql: string): {