diff --git a/examples/connection/typescript/src/returnArgumentsArray.ts b/examples/connection/typescript/src/returnArgumentsArray.ts index 613b5c7..58c78f1 100644 --- a/examples/connection/typescript/src/returnArgumentsArray.ts +++ b/examples/connection/typescript/src/returnArgumentsArray.ts @@ -1,5 +1,4 @@ -import mysql from '../../../../index'; -import type { FieldInfo, Query } from '../../../../index'; +import mysql, { ArgumentsArray } from '../../../../index'; import { Employee } from './employee'; function run() { @@ -13,7 +12,7 @@ function run() { }).then((conn) => { connection = conn; - return connection.query<[data: Employee[], fields: FieldInfo[], query: Query]>('select * from employees limit 0, 10'); + return connection.query>('select * from employees limit 0, 10'); }).then(([data, fields, query]) => { console.log(`The SQL for the query was: ${query.sql}\n`); @@ -40,7 +39,7 @@ async function runAwait() { returnArgumentsArray: true }); - const [data, fields, query] = await connection.query<[data: Employee[], fields: mysql.FieldInfo[], query: Query]>('select * from employees limit 0, 10'); + const [data, fields, query] = await connection.query>('select * from employees limit 0, 10'); console.log(`The SQL for the query was: ${query.sql}\n`); diff --git a/index.d.ts b/index.d.ts index 58b4727..e173d43 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,7 +1,5 @@ import * as mysql from 'mysql'; -import * as Bluebird from 'bluebird'; - -export type { FieldInfo } from 'mysql'; +import Bluebird from 'bluebird'; export function createConnection(connectionUri: string | ConnectionConfig): Bluebird; @@ -12,6 +10,8 @@ export function createPoolCluster(config: mysql.PoolClusterConfig): Bluebird = [data: T[], fields: mysql.FieldInfo[], query: Query]; export interface ConnectionConfig extends mysql.ConnectionConfig { mysqlWrapper?: (mysql: mysqlModule, callback?: (err: Error | null, success?: mysqlModule) => void) => mysqlModule | Promise | void; returnArgumentsArray?: boolean;