From afd3bc79a51e7cacdff1a4f337dd418b8944fb60 Mon Sep 17 00:00:00 2001 From: Gordon Leigh Date: Mon, 25 Nov 2024 16:52:37 +0100 Subject: [PATCH] breaking: fix incorrect typescript types Fixed according to Definitely Typed [Best Practices][1] [1]: https://github.com/DefinitelyTyped/DefinitelyTyped?tab=readme-ov-file#arethetypeswrongcli-attw-checks --- packages/full_sdk/lib/index.d.ts | 4 ++-- packages/full_sdk/test-d/index.test-d.ts | 4 ++-- packages/mysql/lib/index.d.ts | 3 ++- packages/mysql/lib/mysql_p.d.ts | 3 ++- packages/mysql/test-d/index.test-d.ts | 2 +- packages/postgres/lib/index.d.ts | 3 ++- packages/postgres/lib/postgres_p.d.ts | 3 ++- packages/postgres/test-d/index.test-d.ts | 2 +- 8 files changed, 14 insertions(+), 10 deletions(-) diff --git a/packages/full_sdk/lib/index.d.ts b/packages/full_sdk/lib/index.d.ts index a314ade4..7f67d6c7 100644 --- a/packages/full_sdk/lib/index.d.ts +++ b/packages/full_sdk/lib/index.d.ts @@ -1,6 +1,6 @@ import * as express from 'aws-xray-sdk-express'; -import { captureMySQL } from 'aws-xray-sdk-mysql'; -import { capturePostgres } from 'aws-xray-sdk-postgres'; +import captureMySQL from 'aws-xray-sdk-mysql'; +import capturePostgres from 'aws-xray-sdk-postgres'; export * from 'aws-xray-sdk-core'; diff --git a/packages/full_sdk/test-d/index.test-d.ts b/packages/full_sdk/test-d/index.test-d.ts index aa6e99a4..b9209a12 100644 --- a/packages/full_sdk/test-d/index.test-d.ts +++ b/packages/full_sdk/test-d/index.test-d.ts @@ -1,6 +1,6 @@ import * as express from 'aws-xray-sdk-express'; -import { captureMySQL } from 'aws-xray-sdk-mysql'; -import { capturePostgres } from 'aws-xray-sdk-postgres'; +import captureMySQL from 'aws-xray-sdk-mysql'; +import capturePostgres from 'aws-xray-sdk-postgres'; import { expectType } from 'tsd'; import * as AWSXRay from '../lib'; diff --git a/packages/mysql/lib/index.d.ts b/packages/mysql/lib/index.d.ts index 0d21cde0..e4bb1685 100644 --- a/packages/mysql/lib/index.d.ts +++ b/packages/mysql/lib/index.d.ts @@ -1 +1,2 @@ -export * from './mysql_p'; +import captureMySQL from './mysql_p'; +export = captureMySQL; diff --git a/packages/mysql/lib/mysql_p.d.ts b/packages/mysql/lib/mysql_p.d.ts index 5eef4931..62b1d2fd 100644 --- a/packages/mysql/lib/mysql_p.d.ts +++ b/packages/mysql/lib/mysql_p.d.ts @@ -1,7 +1,8 @@ import * as AWSXRay from 'aws-xray-sdk-core'; import * as MySQL from 'mysql'; -export function captureMySQL(mysql: typeof MySQL): captureMySQL.PatchedMySQL; +declare function captureMySQL(mysql: typeof MySQL): captureMySQL.PatchedMySQL; +export = captureMySQL; declare namespace captureMySQL { interface PatchedQueryFunction { diff --git a/packages/mysql/test-d/index.test-d.ts b/packages/mysql/test-d/index.test-d.ts index cad8170e..331322fe 100644 --- a/packages/mysql/test-d/index.test-d.ts +++ b/packages/mysql/test-d/index.test-d.ts @@ -2,7 +2,7 @@ import * as AWSXRay from 'aws-xray-sdk-core'; import * as MySQL from 'mysql'; import { expectType } from 'tsd'; -import { captureMySQL } from '../lib'; +import captureMySQL from '../lib'; const segment = AWSXRay.getSegment(); diff --git a/packages/postgres/lib/index.d.ts b/packages/postgres/lib/index.d.ts index 91da7a21..4996d1a1 100644 --- a/packages/postgres/lib/index.d.ts +++ b/packages/postgres/lib/index.d.ts @@ -1 +1,2 @@ -export * from './postgres_p'; +import capturePostgres from './postgres_p'; +export = capturePostgres diff --git a/packages/postgres/lib/postgres_p.d.ts b/packages/postgres/lib/postgres_p.d.ts index 631256cf..18a04864 100644 --- a/packages/postgres/lib/postgres_p.d.ts +++ b/packages/postgres/lib/postgres_p.d.ts @@ -1,7 +1,8 @@ import * as AWSXRay from 'aws-xray-sdk-core'; import * as PG from 'pg'; -export function capturePostgres(pg: typeof PG): capturePostgres.PatchedPostgres; +declare function capturePostgres(pg: typeof PG): capturePostgres.PatchedPostgres +export = capturePostgres; declare namespace capturePostgres { interface CaptureQueryMethod { diff --git a/packages/postgres/test-d/index.test-d.ts b/packages/postgres/test-d/index.test-d.ts index 42b79dfe..1f410af1 100644 --- a/packages/postgres/test-d/index.test-d.ts +++ b/packages/postgres/test-d/index.test-d.ts @@ -2,7 +2,7 @@ import * as AWSXRay from 'aws-xray-sdk-core'; import * as PG from 'pg'; import { expectType } from 'tsd'; -import { capturePostgres } from '../lib'; +import capturePostgres from '../lib'; const segment = AWSXRay.getSegment();