Top Banner
Intro to TypeScript Matt Harrington http:// aka.ms/mattharrington @mh415
11

Intro to TypeScript, HTML5DevConf Oct 2013

May 10, 2015

Download

Technology

Matt Harrington

Matt Harrington's slides from "Introduction to TypeScript" at HTML5DevConf, Oct 2013, San Francisco.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Intro to TypeScript, HTML5DevConf Oct 2013

Intro to TypeScriptMatt Harrington

http://aka.ms/mattharrington@mh415

Page 2: Intro to TypeScript, HTML5DevConf Oct 2013

Agenda

• What is TypeScript and why should you care?• How to install and use• Demos• Feature overview• Benefits for:

• jQuery users• Angular devs• Library writers

• Larger apps

Page 3: Intro to TypeScript, HTML5DevConf Oct 2013

What is TypeScript?

TypeScript is a language for application-scale JavaScript development.

TypeScript is a typed superset of JavaScript that compiles to plain JavaScript.

Any browser. Any host. Any OS. Open Source.

Page 4: Intro to TypeScript, HTML5DevConf Oct 2013

TypeScript• Classes, modules, arrow

functions (coming in ES6)• Interfaces, optional static

typing

JavaScript ES5

Page 5: Intro to TypeScript, HTML5DevConf Oct 2013

Workflow

File.ts compiler File.js

tsc --out File.js File.ts

Page 6: Intro to TypeScript, HTML5DevConf Oct 2013

JavaScript types

String Number Boolean Object

Array Null Undefined

Prefer the terms static and dynamic to strong and weak

Page 7: Intro to TypeScript, HTML5DevConf Oct 2013

How does TypeScript compare to …?

• Check out Bryan Klimt’s session:• “Stop Writing JavaScript by Hand: 7 Ways Transpiling Makes JavaScript Better”• Wednesday @ 1:30pm• Room N-125

Page 8: Intro to TypeScript, HTML5DevConf Oct 2013

How does TypeScript compare to …?

TypeScript CoffeeScript Dart

Main aim? Enable large-scale app dev with JavaScript

Cleaner syntax, but compiles to JavaScript

“A new language, with tools and libraries, for structured web app engineering”

JS or something else? Yes, TS is a superset New language New language

Static typing? Yes No Yes

Classes, OOP? Yes Yes Yes

Use 3rd party JS? Yes Yes Sorta (js-interop)

Mac, Linux, Windows? Yes Yes Yes

Which VM? Any JS VM Any JS VM Dart VM or JS VM

Adapted from TypeScript Revealed by Dan Maharry

Page 9: Intro to TypeScript, HTML5DevConf Oct 2013
Page 10: Intro to TypeScript, HTML5DevConf Oct 2013

Summary

• Typescriptlang.org & CodePlex• TypeScript adds:

1. Classes2. Modules3. Interfaces4. Arrow functions5. Optional static typing

• Compiles to plain old JavaScript. Use anywhere.• Any JavaScript is TypeScript• Use tons of 3rd party libraries• Use it today on projects large and small

Page 11: Intro to TypeScript, HTML5DevConf Oct 2013

Questions?

@mh415/@msdev

Tweet your questions to @mh415 and use these hashtags #html5devconf and #msdev