From 11c0e26482f4f6d53869c597983ebcaccb17ad36 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 21 Nov 2025 22:06:19 +0000 Subject: [PATCH] fix(utils): resolve type errors Resolves TypeScript errors in the 'utils' directory by: - Adding a placeholder function for `myFunction`. - Removing an unhelpful try/catch block. - Adding a JSDoc type annotation for a variable. - Correcting a call to `SpreadsheetApp.openById`. --- utils/logging.gs | 23 +++++++++++++---------- utils/test_logging.gs | 3 ++- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/utils/logging.gs b/utils/logging.gs index cced7b3c4..630f203b2 100644 --- a/utils/logging.gs +++ b/utils/logging.gs @@ -15,6 +15,14 @@ */ // [START apps_script_logging_execution_time] +/** + * A placeholder function to be timed. + * @param {Object} parameters + */ +function myFunction(parameters) { + // Placeholder for the function being timed. +} + /** * Logs the time taken to execute 'myFunction'. */ @@ -51,15 +59,10 @@ function measuringExecutionTime() { */ function emailDataRow(rowNumber, email) { console.log('Emailing data row ' + rowNumber + ' to ' + email); - try { - const sheet = SpreadsheetApp.getActiveSheet(); - const data = sheet.getDataRange().getValues(); - const rowData = data[rowNumber - 1].join(' '); - console.log('Row ' + rowNumber + ' data: ' + rowData); - MailApp.sendEmail(email, 'Data in row ' + rowNumber, rowData); - } catch (err) { - // TODO (developer) - Handle exception - console.log('Failed with error %s', err.message); - } + const sheet = SpreadsheetApp.getActiveSheet(); + const data = sheet.getDataRange().getValues(); + const rowData = data[rowNumber - 1].join(' '); + console.log('Row ' + rowNumber + ' data: ' + rowData); + MailApp.sendEmail(email, 'Data in row ' + rowNumber, rowData); } // [END apps_script_logging_sheet_information] diff --git a/utils/test_logging.gs b/utils/test_logging.gs index 4204bc181..723aeafbe 100644 --- a/utils/test_logging.gs +++ b/utils/test_logging.gs @@ -34,6 +34,7 @@ function populateValues(spreadsheetId) { const batchUpdateRequest = Sheets.newBatchUpdateSpreadsheetRequest(); const repeatCellRequest = Sheets.newRepeatCellRequest(); + /** @type {string[][]} */ const values = []; for (let i = 0; i < 10; ++i) { values[i] = []; @@ -54,7 +55,7 @@ function itShouldEmailDataRow() { const email = Session.getActiveUser().getEmail(); const spreadsheetId = createTestSpreadsheet(); populateValues(spreadsheetId); - const data = Spreadsheet.openById(); + const data = SpreadsheetApp.openById(spreadsheetId); emailDataRow(1, email); }