Skip to content

Instantly share code, notes, and snippets.

@MartynJones87
Created February 21, 2017 12:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MartynJones87/7c44cdcc8960bfded661e0de48c90c76 to your computer and use it in GitHub Desktop.
Save MartynJones87/7c44cdcc8960bfded661e0de48c90c76 to your computer and use it in GitHub Desktop.
Sample Typescript class structure
export class SampleClass {
// Public class variables
name: string;
// Protected class variables
protected protectedName: string;
// Private class variables
private privateName: string;
constructor() {
this.name = "SampleClass";
this.protectedName = "SampleClass";
this.privateName = "SampleClass";
}
// Public functions
somePublicFunction(): void {
if(true){
doSomething();
}
}
somePublicLambdaFunction = () => {
}
// Protected functions
protected someProtectedFunction(): void {
}
protected someProtectedLambdaFunction = () => {
}
// Private functions
private somePrivateFunction(): void {
}
private somePrivateLambdaFunction = () => {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment