1. How to create a Class:
2. The Class always need a constructor:
class Example { classProperty = null; constructor() { } }
3. Don’t use the function key word to create a function.
class Example { classProperty = null; constructor() { } getData() { } }
4. How to create a Class with a namespace.
module myNamespace { export class Example { classProperty = null; constructor() { } } }
5. How to extend a Class.
///<reference path='folder/path/BaseClass.ts'/> module myNamespace { import BaseClass = anotherNamespace.BaseClass; export class Example extends BaseClass { classProperty = null; constructor() { } } }
6. How to compile. GruntJS.
grunt typescript
typescript: { main: { src: ['<%= DEVELOPMENT_PATH %>' + 'scripts/TestApp.ts'], dest: '<%= DEVELOPMENT_PATH %>' + 'scripts/_compiled/app.js', options: { target: 'es3', base_path: '', sourcemap: false, declaration: false, nolib: false, comments: false } } }
Needs to be compiled.
Need to create Ambient Class Declarations to use 3rd party js libraries like jQuery, Handlebars, etc
declare var Handlebars:any
Don’t use Type annotations.
Create a TypeScript boilerplate: TypeScript boilerplate
StructureTS a TypeScript framework.
Write a series of tutorials on how to build a Single Page Website App with TypeScript and StructureTS: Demo