Skip to content

Instantly share code, notes, and snippets.

@chyld
Last active May 5, 2016 06:32
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 chyld/5e6405dc97fc2e9b71894ac9a5dc5e29 to your computer and use it in GitHub Desktop.
Save chyld/5e6405dc97fc2e9b71894ac9a5dc5e29 to your computer and use it in GitHub Desktop.
types:
boolean, number, string, number[], [string, number], enum, any, void
cast:
<string>val or (val as string).length
declarations:
var, let, const
destructuring:
let [, second, , fourth, ...rest] = [1, 2, 3, 4, 5, 6, 7];
let {a, b} = {a:3, b:2};
interfaces:
interface MyType {
label: string;
color?: string;
[propName: string]: any;
(source: string, subString: string): boolean;
currentTime: Date;
setTime(d: Date);
}
classes:
functions:
function add(x: number, y?: number, c = 3, ...rest): number {
return x + y;
}
generics:
function identity<T>(arg: T): T {
return arg;
}
union types:
function padLeft(value: string, padding: string | number) {
}
intersection types:
a & b
type aliases:
type Name = string;
modules:
namespaces:
decorators:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment