TypeScript 101

1,284 views

Published on

TypeScript 101. TypeScript is a tool that allows you to utilize object oriented programming techniques with your JavaScript code. With TypeScript you have the same sort of namespaces and classes that you use to build your business objects. TypeScript classes support both inheritance and interfaces. We’ll introduce you to these concepts and show you how to use TypeScript to manage and organize your JavaScript code.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,284
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
19
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

TypeScript 101

  1. 1. TypeScript 101Ross Termanwww.xeq.comrterman@xeq.comted by Ross Terman
  2. 2. What is TypeScriptTypeScript is a superset of JavaScriptYou can enter pure JavaScript into TypeScriptTypeScript gives you type safety.TypeScript gives you encapsulation.TypeScript allows you to organize your code into Modules and Classes
  3. 3. Get TypeScriptwww.TypeScriptLang.orghttp://www.typescriptlang.org/Content/TypeScript%20Language%20Specification.pdfWeb Essentials
  4. 4. TypeScript Features• Standard JavaScript Code• Static Typing• Encapsulation with Modules and Classes• Classes support Constructors, Properties, Fields and Functions• Interfaces• Lambda Functions =>• Intellisense and syntax checking
  5. 5. Additional Keywords and Operators exports and importsconstructorextendsimplementsInterfacepublic/private… Rest syntax=> Arrow or lambda functions<typename> type conversion: assignment
  6. 6. Code Hierarchy Module Interface Class Fields Constructors Properties Functions
  7. 7. TypesType InferenceAnnotationsType Definition FilesPrimitive Types: Number, String, Boolean, Any, Null, UndefinedObject Types
  8. 8. FunctionsParameters – Required and OptionalArrow (lambda) functionsVoid for functions that return no value
  9. 9. ClassesClass Members – Fields, Properties, Functions, ConstructorsAdd functions to a class. Note lack of function keywordDefine propertiesComplex Types (object types) – Instantiate with New keywordTypes can be casthttps://github.com/borisyankov/DefinetlyTypedExtending Types – super() function. Similar to baseImmediately-invoked function expression – iffy
  10. 10. InterfacesOptional membersImplementingUsing an Interface as a typeExtend interface
  11. 11. ModulesBenefits – Separation of concern, maintainable, testable, reusableOpen – Can be exposed for both Import and ExportAsynchronous Module Definition - AMD
  12. 12. Resourceshttp://www/typescriptlang.orghttp://www.typescriptlang.org/Content/TypeScript%20Language%20Specification.pdfhttp://www.johnpapa.net/http://weblogs.asp.net/dwahlin/http://pluralsight.com/training/
  13. 13. Contact UsRoss Terman – 305-726-6925rterman@xeq.com@xeqinfo

×