• MVP Microsoft • MCP – MCTS – MCPD – MCT • Especialista em desenvolvimento web • Arquiteto de Soluções / Consultor Independente • Há 14 anos de comunidade .NET • @rodrigokono • www.rodrigokono.net • youtube.com/rodrigokono Rodrigo Kono h t t p : / / a b o u t . m e / r k o n o
Antes de iniciarmos... ...o mindset mudou
Entendendo um pouco mais… Desenvolvido pela Microsoft Feito em TypeScript Superset do ES6 que pode transpilar para rodar dentro do ES5
TypeScript • Começa com JavaScript • Tipos estáticos opcionais, classes e modulos • Termina com JavaScript
Alternativas Script# scriptsharp.com C# S# Dart dartlang.org custom lang by Google CoffeeScript coffeescript.org custom lang. Clojurescript github.com/clojure/clo jurescript custom lang.
JavaScript keywords • break • case • catch • continue • debugger • default • delete • else • finally • for • function • if • in • instanceof • new • return • switch • this • throw • try • typeof • var • while • with
ES6 keywords • break • case • class • catch • const • continue • debugger • default • delete • do • else • export • extends • finally • for • function • if • import • in • instanceof • let • new • return • super • switch • this • throw • try • typeof • var • void • while • with • yield
ES6 Features https://github.com/lukehoban/es6features
ES6 é real com TypeScript Fortemente tipado Classes Interfaces Generics Modulos Definições de Tipo Transpila para JavaScript Funcionalidades do EcmaScript 6
jogador = new Jogador(1, ‘Rodrigo’, ‘Kono’)
Com JavaScript function Jogador(id, nome, sobrenome) { this.id = id; this.nome = nome; this.sobrenome = sobrenome; } Jogador.prototype = { obtemId: function() { return this.id; }, obtemNome: function() { return this.nome; }, obtemSobrenome: function() { return this.sobrenome; }, defineNome: function(nome) { this.nome = nome; }, defineSobrenome: function(sobrenome) { this.sobrenome = sobrenome; } };
Com TypeScript class Jogador { private id: number; private nome: string; private sobrenome: string; constructor(id: number, nome: string, sobrenome: string) { this.id = id; this.nome = nome; this.sobrenome = sobrenome; } obtemId() { return this.id; } obtemNome(): string { return this.nome; } defineNome(nome: string) { this.nome = nome; } obtemSobrenome(): string { return this.sobrenome; } defineSobrenome(sobrenome: string) : void { this.sobrenome = sobrenome; } }
Funcionalidades base do TypeScript
TypeScript na comunidade
Angular 2: feito em TypeScript • http://blogs.msdn.com/b/typescript/archive/2015/03/05/angular-2-0-built-on-typescript.aspx • http://blogs.msdn.com/b/visualstudio/archive/2015/03/12/a-preview-of-angular-2-and-typescript-in-visual-studio.aspx
https://youtu.be/QHulaj5ZxbI?t=20m53s Angular 2 com TypeScript no ng-conf 2015
https://angular.io/docs/ts/latest/quickstart.html
Concluindo
Recursos para estudos http://www.typescriptlang.org http://www.typescriptlang.org/Playground https://github.com/borisyankov/DefinitelyTyped https://github.com/Microsoft/TypeScript https://angular.io/docs/ts/latest/quickstart.html https://channel9.msdn.com/Search?term=typescript
contato@rodrigokono.net about.me/rkono

TypeScript: turbinando os poderes do desenvolvedor javascript