Typescripts
by Khanh Huynh
1. Namespace
1.1. namespace Foo { }
2. Interface
2.1. interface Foo { }
3. Enum
3.1. enum Color { Red }
4. Quotes
4.1. Prefer single quotes (') unless escaping
5. Array
5.1. foos:Foo[]
5.2. foos:Array<Foo>
6. Variable and Function
6.1. var fooVar; function barFunc() { }
7. Class
7.1. class Foo { }
8. Null vs Undefined
8.1. let foo = {x:123,y:undefined};
8.2. let foo:{x:number,y?:number} = {x:123};
8.3. return null;
8.4. return undefined;
8.5. if (error === null)
8.6. if (error)
8.7. if (error !== null)
8.8. if (error != undefined)
9. Spaces
9.1. Use 2 spaces. Not tabs.
10. Filename
10.1. camelCase. E.g. accordian.tsx, myControl.tsx, utils.ts, map.ts etc.