Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

210
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda