Search code examples
javascriptgoogle-apps-scriptjsdoc

create a function with specific parameter types


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}

Solution

  • 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.