TypeScript

The JavaScript with Power-up

Luiz Carlos

Engenheiro de Software
@ CESAR

Bruno Lima

Front-end Developer
@ CESAR

Agenda

  • -- History
  • -- Today
  • -- Types
  • -- Tooling
  • -- Interfaces
  • -- Generics
  • -- Debugging
  • -- and the Future
Microsoft and JavaScript

Anders Hejlsberg

  • -- C#
  • -- Turbo Pascal
  • -- Delphi

2012

TypeScript --version 0.8

Angular

Angular 2.0

Aurelia

Aurelia 1.0

VS Code Sublime Atom Eclipse emacs WebStorm Vim
Set TypeScript

Install


$ npm install -g typescript
					

Compile


$ tsc helloworld.ts
					

Types


let name: string;
let age: number;
let isEnabled: boolean;
let pets: string[];
let accessories: string | string[];
let attributes: [string, number];
let foo: any;
let unusable: void = undefined;
let customer: IWarrior;

					

# demo

Tooling

  • Code Help/ Intellisense
  • Refactoring
  • Peek/Go To
  • Find References

# demo

Interfaces


interface IWarrior {
	firstName: string;
	lastName: string;
	dead?: boolean;
}

let person: IWarrior = {
	firstName: 'Ned',
	lastName: 'Stark'
}
					

# demo

Generics


export class FamilyStark<T> {
	add(member: T) {...}
}

let starks = new FamilyStark<IWarrior>();

starks.add({
	firstName: 'Jon',
	lastName: 'Snow',
	dead: false
});
					

Debugging

# demo

The Future

2.0

beta

More

;) Thanks!

  • -- bruno.lima@cesar.org.br
  • -- luiz.carlos@cesar.org.br
#TypeScript
#IntervaloCESAR
CESAR