Skip to content

Instantly share code, notes, and snippets.

@jeffmo
Last active January 11, 2024 06:05
Show Gist options
  • Save jeffmo/054df782c05639da2adb to your computer and use it in GitHub Desktop.
Save jeffmo/054df782c05639da2adb to your computer and use it in GitHub Desktop.
ES Class Property Declarations
@WeeHorse
Copy link

Accepting

class Whatever{
  someSymbolThatIsAFunction(){
    // yeah they call me a method but I am of the Function type
  }
}

but not

class Whatever{
  someSymbolThatIsNotAFunction = 1;
}

is to violate JS syntax basics.

@bounceme
Copy link

bounceme commented Jun 2, 2017

so are semicolons required after each instance property set using this proposed syntax? otherwise a criticism i have is that the class body is messier and looks too much like any other set of statements of a regular function, and parsing things like *ident (){} is much harder

@littledan
Copy link

No, semicolons are not required; they follow normal ASI rules and may come automatically. The grammar contains semicolons, just as it does at the end of normal statements which are also subject to ASI.

@dawsbot
Copy link

dawsbot commented Jun 29, 2017

Should be updated from "stage 0" in the description of this gist to "stage 2" @jeffmo. Thanks for the information 👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment