Created
February 21, 2017 12:00
-
-
Save MartynJones87/7c44cdcc8960bfded661e0de48c90c76 to your computer and use it in GitHub Desktop.
Sample Typescript class structure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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