Upgrade to Pro — share decks privately, control downloads, hide ads and more …

TypeScript: JavaScript for on Steroids

TypeScript: JavaScript for on Steroids

This session gives a brief introduction to TypeScript. The source code can be found at https://github.com/toedter/typescript-contacts-demo. TypeScript was created by Microsoft (Anders Hejlsberg) and is licensed under Apache 2.0. The main Web resource is typescriptlang.org. Here you find all information and you can play around live with a nice editor (seeing the original TypeScript and the compiled JavaScript). Currently the TypeScript compiler runs either as a node.js module or using Windows Scripting host. This slide deck is licensed under a Creative Commons Attribution 4.0 International License.

A0aae1297a0593c1316abdcdb4131e3a?s=128

Kai Toedter

June 19, 2015
Tweet

Transcript

  1. TypeScript JavaScript on Steroids Kai Tödter 6/23/2015 1 © Kai

    Tödter, Licensed under a Creative Commons Attribution 4.0 International License.
  2. Who am I?  Senior Software System Architect at Siemens

    Building Technologies  Web Technology Fan  Open Source Lover  E-mail: kai@toedter.com  Twitter: twitter.com/kaitoedter  Google+: gplus.to/toedter  Blog: toedter.com/blog 6/23/2015 2 © Kai Tödter, Licensed under a Creative Commons Attribution 4.0 International License.
  3. Show Hands! 6/23/2015 © Kai Tödter, Licensed under a Creative

    Commons Attribution 4.0 International License. 3
  4. TypeScript? 6/23/2015 © Kai Tödter, Licensed under a Creative Commons

    Attribution 4.0 International License. 4
  5. After this session I’ll have an idea what TypeScript is

    all about! 6/23/2015 © Kai Tödter, Licensed under a Creative Commons Attribution 4.0 International License. 5
  6. Outline  Why JavaScript scares many Java/OO developers  TypeScript

    Introduction  Demos & Live Coding 6/23/2015 6 © Kai Tödter, Licensed under a Creative Commons Attribution 4.0 International License.
  7. JavaScript? Many Java/OO developers don’t like JavaScript regarding writing larger

    applications. Some reasons are:  No static typing  No reliable code completion (only best guess)  Hard to refactor  Not object-oriented, especially  No structuring mechanisms like Interfaces, Classes, Modules  … 6/23/2015 © Kai Tödter, Licensed under a Creative Commons Attribution 4.0 International License. 7
  8. Who fixes that?  Dart  Great language by Google:

    dartlang.org  Team has to learn new language  Either runs on Dart VM or compiles to JavaScript  CoffeeScript  Ruby-like, concise syntax  Compiles to JavaScript  coffescript.org  BabelJS  JavaScript compiler  babeljs.io  Traceur  JavaScript compiler  github.com/google/traceur-compiler 6/23/2015 © Kai Tödter, Licensed under a Creative Commons Attribution 4.0 International License. 8
  9. TypeScript: Summary  Typed Superset of JavaScript  Almost all

    valid JavaScript is valid TypeScript*  Compiles to JavaScript  Provides optional static type checking at compile time  For most existing JavaScript libraries there are type definitions available  Provides Interfaces, Classes, Modules, Enums, Generics and more  Open Source: Apache 2.0 License  Created by Microsoft * Exceptions mostly related to type inference 6/23/2015 © Kai Tödter, Licensed under a Creative Commons Attribution 4.0 International License. 9
  10. How to get started?  www.typescriptlang.org  Install node.js (nodejs.org)

     Invoke “npm install –g typescript”  Compile a TypeScript file: “tsc myTypeScript.ts”  Results in “myTypeScript.js” 6/23/2015 © Kai Tödter, Licensed under a Creative Commons Attribution 4.0 International License. 10
  11. www.typescriptlang.org 6/23/2015 © Kai Tödter, Licensed under a Creative Commons

    Attribution 4.0 International License. 11
  12. Play! 6/23/2015 © Kai Tödter, Licensed under a Creative Commons

    Attribution 4.0 International License. 12
  13. Definitely Typed 6/23/2015 © Kai Tödter, Licensed under a Creative

    Commons Attribution 4.0 International License. 13
  14. WebStorm/IntelliJ IDEA 6/23/2015 © Kai Tödter, Licensed under a Creative

    Commons Attribution 4.0 International License. 14
  15. Eclipse 6/23/2015 © Kai Tödter, Licensed under a Creative Commons

    Attribution 4.0 International License. 15
  16. Visual Studio 6/23/2015 © Kai Tödter, Licensed under a Creative

    Commons Attribution 4.0 International License. 16
  17. Live Demo https://github.com/toedter/typescript-contacts-demo https://github.com/toedter/chatty https://github.com/toedter/webapp-tutorial https://github.com/toedter/angular2-typescript-demo 6/23/2015 © Kai Tödter,

    Licensed under a Creative Commons Attribution 4.0 International License. 17
  18. 6/23/2015 © Kai Tödter, Licensed under a Creative Commons Attribution

    4.0 International License. 18 Discussion
  19. License  This work is licensed under a Creative Commons

    Attribution 4.0 International License.  See http://creativecommons.org/licenses/by/4.0/ 6/23/2015 © Kai Tödter, Licensed under a Creative Commons Attribution 4.0 International License. 19