Skip to content

Instantly share code, notes, and snippets.

@BobNisco
Created March 5, 2014 17:54
Show Gist options
  • Save BobNisco/9372605 to your computer and use it in GitHub Desktop.
Save BobNisco/9372605 to your computer and use it in GitHub Desktop.
TypeScript Example
public foo(x: string) {
if (x == "bar") {
return 1;
} else {
return false;
}
}
var x = 0;
x = "hello";
var x: any = 0;
x = "hello";
// 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);
module Example {
export class Node {
// Creates a Node class with 3 private attributes
constructor(private value: number, private leftChild: Node, private rightChild: Node) {
}
}
}
var x: number = 0;
x = "hello";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment