From ec80900657e85404f576b7578ecc9bd07542261c 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 | 7 +++++-- src/backend/Drive-shim.d.ts | 2 ++ 3 files changed, 8 insertions(+), 3 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..99dc9f22 100644 --- a/backend.tsconfig.json +++ b/backend.tsconfig.json @@ -3,7 +3,10 @@ "compilerOptions": { "target": "es6", "lib": ["es6"], - "types": ["google-apps-script"], + "types": ["google-apps-script", "google.script.client-side"], "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..970f69ee --- /dev/null +++ b/src/backend/Drive-shim.d.ts @@ -0,0 +1,2 @@ +// eslint-disable-next-line no-var, @typescript-eslint/naming-convention -- GAS global, needs var +declare var Drive: GoogleAppsScript.Drive_v2;