TypeScript

Naming Conventions

Default to lowerCamelCase
Class names UpperCamelCase

文件的评论s

  • 80 columns wide
  • Project Name
  • GitHub link
  • Copyright

Ex:

/****************************************************************************** * EE Pocket Reference * * Source: https://github.com/Digilent/ee-pocket-reference * Copyright (c) 2016, Digilent  ****************************************************************************/

Class parameter properties

  • Declare passed in parameters outside the constructor and assign values inside constructor.

Imports

Import 3rd party stuff just below the top block comment. Separate app specific imports into groups

ex

import 'es6-shim'; import {App, IonicApp, Platform, MenuController} from 'ionic-angular'; import {StatusBar} from 'ionic-native'; //Pages import {ResistorPage} from './pages/resistors/resistors'; //Components import {ResistorComponent} from '../components/resistors/resistors'; //Services import {ResistorService} from '../services/resistors/resistors';