Introducing type script
-
Upload
remo-jansen -
Category
Software
-
view
931 -
download
1
Transcript of Introducing type script
Introducing TypeScriptLarge scale JavaScript application development made easyBy Remo H. Jansen
What is TypeScript?TypeScript is a typed superset of JavaScript.
Compiles to plain JavaScript.
Any IDE. Any browser. Any host. Any OS.Open Source.
Based on open standards (ES6, ES7...).
JavaScript is TypeScript!
“We’re excited to announce that we have converged the TypeScript and AtScript languages, and that Angular 2, the next version of the popular JavaScript library for building web sites and web apps, will be developed with TypeScript”
Why do we need TypeScript? (PART I)“As a system evolves, its complexity increases unless steps are taken to reduce it”
JavaScript was not designed to deal with the level of complexity required to meet today’s needs.
Complex !== ComplicatedComplicated implies being difficult to understand but
with time and effort, ultimately knowable.
Complex describes the interactions between a number of entities. If the number of entities and interactions between them increase we will get to a point where it would be impossible to know and understand all of them.
TypeScript is the future of JavaScriptTypeScript allows us to use ES6 and ES7
today!
We can use the --target compiler option to specify ECMAScript target version: ES3, ES5 or ES6.
Classes
Inheritance
ModulesWe can use the --module compiler option to specify module code generation:
CommonJS
AMD
System
UMD
Generators “Synchronous Looking Asynchronous Code”
Async / Await
Decorators
Note: The code snippets above are part of an open-source project I’m working on. You can learn more about it at http://inversify.io/
● Metadata Reflection API
Why do we need TypeScript? (PART II)“Large codebases are more difficult to maintain when they are written in dynamic languages”
TypeScript goes beyond ES6 & ES7TypeScript is a strongly typed
programming language
TypeScript introduces some great design-time features that are not available in ES6 or ES7.
Namespaces● AKA Internal modules● It is recommended to
use ES6 modules instead
Types● Design-time only● Type inference● Optional type
annotations● Type guards● Union types● Intersection types
Interfaces● Design-time only● Structural type system● Type definitions (.d.ts files)
Generics● Design-time only● Generic constraints can be
declared
Getting started with TypeScript!
http://www.typescriptlang.org/Playground
https://github.com/remojansen/ts-vscode-boilerplate
Questions?
Thanks!● Join the Dublin TypeScript Meetup to learn more!
● Get 20% off my book “Learning TypeScript” (eBook) using promo code PACKT20 at www.packtpub.com