-
Notifications
You must be signed in to change notification settings - Fork 1
Code Format
徐宇楠 edited this page Jun 6, 2017
·
9 revisions
//DO NOT USE SHORTCUTS
//such as: instance -> inst
class A {
private _fieldA; //private field should start with _
public static readonly STATIC_FIELD_AAA = 1 //static fields all uppercase
public fieldB; //camel case
//put fields before methods
public sayHello() { //same as public fields
//It is better to put a pair of "{}" after for/if/when... even if there is only one line.
if (this._fieldA) {
}
}
}
- put all custom typings(anything like
declare something
) intotypings
directory - for the typings for global, put it in to
lib.d.ts
- modules' typing, create a file named
{MODULE_NAME}.d.ts
- other typings(for global usage, and just for declaration) create a file named
{NAME}.d.ts
and declare a namespace likeSeityan.{NAME}
put test files into test
directory