From 646f66565ed7b073d7251966ffea373b80568a44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20D=C4=9Bdi=C4=8D?= Date: Wed, 18 Dec 2024 22:32:04 +0100 Subject: [PATCH] Fixed typings for Drive v2 --- __tests__/test-utils/gas-stubs.ts | 2 +- backend.tsconfig.json | 5 ++++- src/backend/Drive-shim.d.ts | 7 +++++++ 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 src/backend/Drive-shim.d.ts diff --git a/__tests__/test-utils/gas-stubs.ts b/__tests__/test-utils/gas-stubs.ts index c8ee51d5..391e49a2 100644 --- a/__tests__/test-utils/gas-stubs.ts +++ b/__tests__/test-utils/gas-stubs.ts @@ -40,7 +40,7 @@ export function mockedCommentsCollection(): GoogleAppsScript.Drive.Collection.Co }; } -export function mockedDrive(): GoogleAppsScript.Drive { +export function mockedDrive(): GoogleAppsScript.Drive_v2 { return { newChannel: jest.fn<() => GoogleAppsScript.Drive.Schema.Channel>(), newChildReference: diff --git a/backend.tsconfig.json b/backend.tsconfig.json index 8ef0f23c..d6ea6779 100644 --- a/backend.tsconfig.json +++ b/backend.tsconfig.json @@ -5,5 +5,8 @@ "lib": ["es6"], "types": ["google-apps-script"], "verbatimModuleSyntax": false - } + }, + "include": [ + "src/backend/Drive-shim.d.ts" + ] } diff --git a/src/backend/Drive-shim.d.ts b/src/backend/Drive-shim.d.ts new file mode 100644 index 00000000..ce82bbb9 --- /dev/null +++ b/src/backend/Drive-shim.d.ts @@ -0,0 +1,7 @@ +// eslint-disable-next-line @typescript-eslint/naming-convention -- GAS global +declare var Drive: GoogleAppsScript.Drive_v2; + +declare global { + // eslint-disable-next-line @typescript-eslint/naming-convention -- GAS global + var Drive: GoogleAppsScript.Drive_v2; +}