Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Dec 2016
    Posts
    15
    Thanks
    0
    Thanked 1 Time in 1 Post

    TypeScript + Google Apps Script: Need help with some compiler errors.

    I've just discovered TypeScript recently and was playing around converting some of my GAS code using the definitions from https://github.com/motemen/dts-google-apps-script

    I'm having some compiler errors and I was hoping for some help with it. Here are the two errors.

    Code:
    ES System Automation/Job.ts(53,44): error TS2339: Property 'GOOGLE_SHEETS' does not exist on type '{ new (): MimeType; prototype: MimeType; }'.
    ES System Automation/Utilities.ts(28,92): error TS2339: Property 'TABLE' does not exist on type 'ElementType'.
    Looking at the definition files, I can see that the MimeType definition has been commented out because it conflicts with "lib.d.ts". My guess is that "lib.d.ts" defines a lot of things that are available in a normal JavaScript environment, but obviously doesn't work in a GAS environment, so I would like to be able to overwrite MimeType or disable "lib.d.ts", but I don't know how to do that. Plus I'm concerned that it defines a lot of things that do exist in the GAS environment so I'd rather not disable it completely.

    The second one I am having more trouble understanding.

    Here is the offending code:

    Code:
        while(!nextSibling.isAtDocumentEnd() && nextSibling.getType() != DocumentApp.ElementType.TABLE) {
    DocumentApp is exported from "google-apps-script.document.d.ts" located in the repository above and ElementType is defined there. As far as I can tell, it shouldn't have an error, but it is.

  2. #2
    New Coder
    Join Date
    Dec 2016
    Posts
    15
    Thanks
    0
    Thanked 1 Time in 1 Post
    Just wanted to follow up in case someone comes across this in the future. I'm just not used to compiler errors resulting in anything that is usable. However, with TypeScript, that is not the case. When I noticed it was creating the JS files, I went and inspected them, and found the code had just been passed through regardless of the errors.


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •