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

TypeScript for Regular Folks Like Me

TypeScript for Regular Folks Like Me

If you're like me, you've probably heard of TypeScript but never used it. This talk provides a down-to-earth look at TypeScript, a statically typed superset of JavaScript that compiles to plain JavaScript. TypeScript also adds optional static types, classes, interfaces, and modules to JavaScript. This session will consist of a guided tour of TypeScript, showing how the language and toolset makes it easier to write cross-platform, large-scale JavaScript applications.

Michael Crump

October 16, 2015
Tweet

More Decks by Michael Crump

Other Decks in Programming

Transcript

  1. What will we cover? • Why TypeScript? (and some gotchas)

    • What is it? • How to get started using it. • Demos (from the syntax, to debugging, interfaces and classes) • Resources and Q&A
  2. • Large and difficult to maintain JavaScript codebases • Compile

    Time Error • Runtime Errors • Better Auto-Completion • Transpiles to ES3, ES5 or ES6 Where does it shine?
  3. Gotchas • Takes time to add TypeScript to an already

    existing large JavaScript project. • Don’t go into this with the mindset that you will never need to learn JavaScript. • You will write ambient definition for various libraries if your team adopts this.
  4. TypeScript 1.6.x is the latest Stable Version, but you will

    find they have features planned to 2.0. https://github.com/Microsoft/TypeScript/wiki/Roadmap
  5. Very easy to learn for those coming from C based

    languages such as Java, C#, C++.
  6. Others • Baked In: Visual Studio / Visual Studio Code

    • Support for: – WebStorm – Sublime Text – Node.js – Vi – Emacs
  7. 3rd Party Libraries • Typings are defined in files with

    the .d.ts extension. • lib.d.ts file is built-in for the DOM and JavaScript • The repository for TypeScript type definitions can be found at http://definitelytyped.org/
  8. Debugging • Visual Studio has one of the most powerful

    debugging experiences with TypeScript. • TypeScript generates source maps for your code. – You will see these in javascript.ts.map files. • Sometimes you do have to go through the compiled code.
  9. Interfaces Helps us keep our programs error-free by providing information

    about the shape of the data that we are going to work with.
  10. The resulting Type is just a JS Constructor + prototype

    trapped in a IIFE (Immediately-invoked function expression)
  11. Resources • http://www.typescriptlang.org - Official Site • http://definitelytyped.org/ - Type

    File Definitions • https://speakerdeck.com/mbcrump - Slides from this presentation. • https://github.com/mbcrump/TypeScriptTut - Code from this presentation.