Skip to content

Instantly share code, notes, and snippets.

@szydan
Created June 30, 2022 12:19
Show Gist options
  • Save szydan/3b3290a284a060aff5773c5e2aa065b5 to your computer and use it in GitHub Desktop.
Save szydan/3b3290a284a060aff5773c5e2aa065b5 to your computer and use it in GitHub Desktop.
parameter properties typescript

Instead of

class A {
  private p1: string;
  
  constructor(p1: string) {
    this.p1 = p1;
  }
}

we can do

class A {
  constructor(private p1: string) {
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment