Skip to content

Instantly share code, notes, and snippets.

@joeriks
Created October 17, 2014 07:14
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 joeriks/577b3c60244ab2c0814f to your computer and use it in GitHub Desktop.
Save joeriks/577b3c60244ab2c0814f to your computer and use it in GitHub Desktop.
explicitly use "public" function access modifier in Typescript
class Greeter {
// Hard to see which ones of these are function declarations
// and which ones are function calls:
greet0() {
// do something...
}
greet1(){
greet2({
// can you spot the difference?
});
}
// I find it better to state the access modifier explicitly
// that makes it obvious this is a function declaration
// and nothing else
public greet3() {
// do something...
}
// also: it's questionable to use "private" at all here - as it does
// not have any meaning in the compiled code outside of typescript.
// http://stackoverflow.com/questions/16919473/private-functions-in-typescript
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment