Engenheiro de Software
@ CESAR
Front-end Developer
@ CESAR
$ npm install -g typescript
$ tsc helloworld.ts
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;
interface IWarrior {
firstName: string;
lastName: string;
dead?: boolean;
}
let person: IWarrior = {
firstName: 'Ned',
lastName: 'Stark'
}
export class FamilyStark<T> {
add(member: T) {...}
}
let starks = new FamilyStark<IWarrior>();
starks.add({
firstName: 'Jon',
lastName: 'Snow',
dead: false
});