TypeScript. Types

Home » Tutorials » JavaScript » 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

Submit a Comment

Your email address will not be published. Required fields are marked *

Подписаться на рассылку

Будьте в курсе - получайте последние статьи на свой email

Ваша подписка успешно оформлена

Pin It on Pinterest

Share This