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/src/backend/utils/SafeDriveService.ts b/src/backend/utils/SafeDriveService.ts index 1449cb45..32f77d21 100644 --- a/src/backend/utils/SafeDriveService.ts +++ b/src/backend/utils/SafeDriveService.ts @@ -22,12 +22,13 @@ export class SafeDriveService_ { public readonly Replies: GoogleAppsScript.Drive.Collection.RepliesCollection; public constructor() { - if (Drive.Replies === undefined) { + if ((Drive as unknown as GoogleAppsScript.Drive_v2).Replies === undefined) { throw new Error(); } this.Comments = new SafeCommentsCollection_(); this.Drives = new SafeDrivesCollection_(); this.Files = new SafeFilesCollection_(); - this.Replies = Drive.Replies; + this.Replies = + Drive.Replies as unknown as GoogleAppsScript.Drive.Collection.RepliesCollection; } } diff --git a/src/backend/utils/SafeDriveService/SafeCommentsCollection.ts b/src/backend/utils/SafeDriveService/SafeCommentsCollection.ts index 090828d1..d916ffdb 100644 --- a/src/backend/utils/SafeDriveService/SafeCommentsCollection.ts +++ b/src/backend/utils/SafeDriveService/SafeCommentsCollection.ts @@ -24,10 +24,13 @@ export class SafeCommentsCollection_ { private readonly unsafeComments: GoogleAppsScript.Drive.Collection.CommentsCollection; public constructor() { - if (Drive.Comments === undefined) { + if ( + (Drive as unknown as GoogleAppsScript.Drive_v2).Comments === undefined + ) { throw new Error(); } - this.unsafeComments = Drive.Comments; + this.unsafeComments = + Drive.Comments as unknown as GoogleAppsScript.Drive.Collection.CommentsCollection; } private static commentIsSafe( diff --git a/src/backend/utils/SafeDriveService/SafeDrivesCollection.ts b/src/backend/utils/SafeDriveService/SafeDrivesCollection.ts index 89cd8447..c61d387b 100644 --- a/src/backend/utils/SafeDriveService/SafeDrivesCollection.ts +++ b/src/backend/utils/SafeDriveService/SafeDrivesCollection.ts @@ -22,10 +22,11 @@ export class SafeDrivesCollection_ { private readonly unsafeDrives: GoogleAppsScript.Drive.Collection.DrivesCollection; public constructor() { - if (Drive.Drives === undefined) { + if ((Drive as unknown as GoogleAppsScript.Drive_v2).Drives === undefined) { throw new Error(); } - this.unsafeDrives = Drive.Drives; + this.unsafeDrives = + Drive.Drives as unknown as GoogleAppsScript.Drive.Collection.DrivesCollection; } private static driveIsSafe>( diff --git a/src/backend/utils/SafeDriveService/SafeFilesCollection.ts b/src/backend/utils/SafeDriveService/SafeFilesCollection.ts index 532d5e52..4e68dbd5 100644 --- a/src/backend/utils/SafeDriveService/SafeFilesCollection.ts +++ b/src/backend/utils/SafeDriveService/SafeFilesCollection.ts @@ -59,10 +59,11 @@ export class SafeFilesCollection_ { private readonly unsafeFiles: GoogleAppsScript.Drive.Collection.FilesCollection; public constructor() { - if (Drive.Files === undefined) { + if ((Drive as unknown as GoogleAppsScript.Drive_v2).Files === undefined) { throw new Error(); } - this.unsafeFiles = Drive.Files; + this.unsafeFiles = + Drive.Files as unknown as GoogleAppsScript.Drive.Collection.FilesCollection; } private static fileIsSafe>(