Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

208
Views
Are private class properties supported in Google Apps Script?

I attempted to use Private class features in Google Apps Script, using the following snippet:

class Feed
{
  #user;
  #password;
  url;
  
  constructor(url, credentials)
  {
    // class constructor
    this.url = url;
    this.#user = credentials.user;
    this.#password = credentials.password;
  }
}

with the intention of calling it in the following manner:

const url = "https://URL"
const credentials = {user: 'user', password: 'password'};

let feed = new Feed(url, credentials);

On saving the file, the following error was displayed, appearing to indicate that private class features aren't supported in Google Apps Script:

Syntax error: ParseError: Unexpected token ILLEGAL line: 3 file: Testing.gs

I removed the '#' on line three, as shown below:

class Feed
{
  user;
  #password;
  url;
  
  constructor(url, credentials)
  {
    // class constructor
    this.url = url;
    this.#user = credentials.user;
    this.#password = credentials.password;
  }
}

and received the following error on saving:

Syntax error: SyntaxError: Private field '#user' must be declared in an enclosing class line: 11 file: Testing.gs

I searched, and found Define private class fields with Google Apps Scripts (GAS) V8 which indicated that (at the time) private class features weren't supported in Google Apps Script. While the first error message seems to confirm that this is the case, the second implies that Apps Script understands private class fields.

Questions:

  • Are private class fields supported by Google Apps Script (v8)?
  • If so, how are they supposed to be implemented?

Thanks,

Fergal

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!