TypeScript. Types
TypeScript is the superset of JavaScript with strict types. TypeScript realize the most modern ECMAScript features.
In this video we’ll consider types in TypeScript, including enum, any and tuples.
Code lesson
let flag: boolean = true;
flag = false;
let product: [number, string];
product = [1, 'iphone'];
// product = ['Камиль', 1]; error
enum currencies {DOLLAR, EURO, ROUBLE};
console.log(currencies[0]);
enum languages {JavaScript = 11, PHP, Java};
console.log(languages);
let fullName: any = 'Kamil Abzalov';
fullName = 5;
let a: string | number;
type version = string | number;
let ver: version = 10.1;
console.log(ver);
0 Comments