TypeScript

12
TypeScript Fabian Vilers @fvilers http://www.linkedin.com/in/fvilers

description

A TypeScript introduction

Transcript of TypeScript

Page 1: TypeScript

TypeScriptFabian Vilers

@fvilershttp://www.linkedin.com/in/fvilers

Page 2: TypeScript

Who am I ? Founder & owner of Dev One

IT consultant with more than 15 years of experience

Microsoft .NET software architect & technology enthusiast

Father of two daughters, gamer, photographer & poker player

Page 3: TypeScript

Who are you ?

Page 4: TypeScript

Application scale JavaScript development is hard Scripting language

No static typing

Lacks of structuring mechanisms (classes, modules, interfaces)

Page 5: TypeScript

TypeScript is a language for application-scale JavaScript development

TypeScript is a superset of JavaScript that compiles to JavaScript

Any browser, any host, any OS

Open source

Page 6: TypeScript

TypeScript Starts with JavaScript All JavaScript code is TypeScript code, simply copy and paste All JavaScript libraries work with TypeScript

Optional static types, classes, modules Enable scalable application development and excellent tooling Zero cost: static types completely disappear at run-time

Ends with JavaScript Compiles to idiomatic JavaScript Runs in any browser or host, on any OS

Page 7: TypeScript

DemoTypeScript type system

Page 8: TypeScript

Type system Formalization of JavaScript’s types Static representation of JavaScript’s dynamic type system

Type inference and structural typing In practice very few type annotations are necessary

Works with existing JavaScript libraries Declaration files can be written and maintained separately

Not « provable type safe » Types reflect intent but do not provide guarantees

Page 9: TypeScript

DemoTypeScript multi-modules application

Page 10: TypeScript

Classes and modules Scalable application structuring Classes, modules, and interfaces enable clear contracts between components

Aligned with emerging standards Classes, modules, and arrow functions syntax aligns with ECMAScript 6

proposals

Support popular modules systems CommonJS and AMD modules in any ECMAScript 3 compatible environment

Page 11: TypeScript

What’s included ? Compiler Open source, written in TypeScript

Tooling Visual Studio language service, browser hosted playground Source Maps Full support in upcoming Resharper 8.1

Libraries Full static typing of DOM, jQuery, node.js,…

And more Lots of sample and formal language specification

Page 12: TypeScript

ResourcesOfficial website

http://www.typescriptlang.org

Language specification (PDF)

http://go.microsoft.com/fwlink/?LinkId=267238

Repository for high quality TypeScript type definitions

https://github.com/borisyankov/DefinitelyTyped