Created
March 5, 2014 17:54
-
-
Save BobNisco/9372605 to your computer and use it in GitHub Desktop.
TypeScript Example
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
public foo(x: string) { | |
if (x == "bar") { | |
return 1; | |
} else { | |
return false; | |
} | |
} |
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
var x = 0; | |
x = "hello"; |
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
var x: any = 0; | |
x = "hello"; |
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
// Our return (strongly-typed in TypeScript) array of Tokens | |
var tokenStream = new Array<Token>(); | |
// ... Do some more things here ... | |
var newToken = Combobiler.Token.makeNewToken(current, line + 1); | |
tokenStream.push(newToken); |
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
module Example { | |
export class Node { | |
// Creates a Node class with 3 private attributes | |
constructor(private value: number, private leftChild: Node, private rightChild: Node) { | |
} | |
} | |
} |
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
var x: number = 0; | |
x = "hello"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment