From bf69146e25b06d70e3d7c07450f35f2016801114 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luismi=20Ram=C3=ADrez?= Date: Wed, 17 Nov 2021 14:14:59 +0100 Subject: [PATCH] Change global augmentation for newer TS Newer TypeScript versions don't accept the way we augment the global object making the build fail sometimes. Doing it this way we ensure it always works. --- .../fix-compatibility-for-global-object-augmentation.md | 5 +++++ packages/nodejs/global.d.ts | 5 +++++ packages/nodejs/tsconfig.json | 2 +- packages/nodejs/vendor.d.ts | 6 ------ 4 files changed, 11 insertions(+), 7 deletions(-) create mode 100644 packages/nodejs/.changesets/fix-compatibility-for-global-object-augmentation.md create mode 100644 packages/nodejs/global.d.ts diff --git a/packages/nodejs/.changesets/fix-compatibility-for-global-object-augmentation.md b/packages/nodejs/.changesets/fix-compatibility-for-global-object-augmentation.md new file mode 100644 index 00000000..b718fb60 --- /dev/null +++ b/packages/nodejs/.changesets/fix-compatibility-for-global-object-augmentation.md @@ -0,0 +1,5 @@ +--- +bump: "patch" +--- + +Fix TypeScript compatibility for global object augmentation. diff --git a/packages/nodejs/global.d.ts b/packages/nodejs/global.d.ts new file mode 100644 index 00000000..8ba1668d --- /dev/null +++ b/packages/nodejs/global.d.ts @@ -0,0 +1,5 @@ +export {} + +declare global { + var __APPSIGNAL__: any +} diff --git a/packages/nodejs/tsconfig.json b/packages/nodejs/tsconfig.json index 43605857..2657f1b2 100644 --- a/packages/nodejs/tsconfig.json +++ b/packages/nodejs/tsconfig.json @@ -1,6 +1,6 @@ { "extends": "../../tsconfig.json", - "include": ["src/**/*", "vendor.d.ts"], + "include": ["src/**/*", "vendor.d.ts", "global.d.ts"], "exclude": [ "src/**/__tests__", "src/**/__mocks__" diff --git a/packages/nodejs/vendor.d.ts b/packages/nodejs/vendor.d.ts index 792ee64b..25c39dac 100644 --- a/packages/nodejs/vendor.d.ts +++ b/packages/nodejs/vendor.d.ts @@ -17,9 +17,3 @@ declare module "require-in-the-middle" { export = Hook } - -declare module NodeJS { - interface Global { - __APPSIGNAL__: any - } -}