dts-google-apps-script
dts-google-apps-script copied to clipboard
Update your generator to emit ts type "number" for "Integer"
You need to map Apps Script's "Integer" datatype to ts' "number" primitive. It looks like you are already correctly handling the casing of boolean and string (upper case in gas docs, lower case in ts types).
You might also take a look to see if you want to emit "any" instead of "Object". There may be cases where an Apps Script developer is used to calling prototype methods on the return, which in turn the Apps Script runtime is pretty good at handling. The ts compiler would fail on Object, but would allow on 'any'.
Thank you for pointing out, I believe there's a hand-written type alias for Integer
at https://github.com/motemen/dts-google-apps-script/blob/782478f/google-apps-script/google-apps-script.types.d.ts#L9 , which cannot be simply replaced to number
as we want to keep the information that an argument is an integer, not a number including floats.
For the Object
case, it seems reasonable to replace or assign Object
to 'any'. If you don't mind providing some test cases, it would be easier to implement this. Thanks!
Since you are just mapping Apps Script's Integer to ts' number type, it probably is OK doing that explicitly, but you could wait on for more votes than just my 1. I also saw a few instances of String[] that need to be lowercased. For example, in the spreadsheet class DataValidationBuilder#requireValueInList.
@hess-g I created PR GH-9 to fix the String and Boolean array issue