Created
October 17, 2014 07:14
-
-
Save joeriks/577b3c60244ab2c0814f to your computer and use it in GitHub Desktop.
explicitly use "public" function access modifier in Typescript
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
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