I'm making a Google Apps Script function that takes two parameters: a Spreadsheet object and a Transaction object, which I created. How can I specify that I want my parameters to have that type?
I'm looking for this functionality:
function addTransaction(Spreadsheet sheet,Transaction t){//blah blah blah doesn't matter}
You can use JSDoc syntax to show hints, like this. (not sure what Transaction means, but hope you get the idea)
/**
* @param {SpreadsheetApp.Spreadsheet} sheet
* @param {Transaction} t
*/
function addTransaction(sheet, t){ blah blah}
See here or more details: https://jsdoc.app/tags-param
Google Apps Script is based on JavaScript which is not a statically typed language. You can't enforce types. You will need to manually check the types in your function body.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With