Přeskočit na obsah
_CORE
AI & Agentic Systems Core Informační Systémy Cloud & Platform Engineering Data Platforma & Integrace Security & Compliance QA, Testing & Observability IoT, Automatizace & Robotika Mobile & Digital Banky & Finance Pojišťovnictví Veřejná správa Obrana & Bezpečnost Zdravotnictví Energetika & Utility Telco & Média Průmysl & Výroba Logistika & E-commerce Retail & Loyalty
Reference Technologie Blog Know-how
Nástroje O nás Spolupráce Kariéra
Pojďme to probrat

TypeScript od nuly

14. 09. 2019 1 min čtení intermediate

TypeScript přidává typy do JavaScriptu. Zachytí chyby při kompilaci, zlepší DX. Dnes standard pro seriózní projekty.

Základní typy

// Primitivní typy let name: string = ‘Jan’; let age: number = 30; let active: boolean = true; // Interface interface User { id: number; name: string; email: string; role?: ‘admin’ | ‘user’; // Optional + union } // Generics function first(items: T[]): T | undefined { return items[0]; } // Utility types type PartialUser = Partial; type UserWithoutId = Omit;

tsconfig.json

{ “compilerOptions”: { “target”: “ES2022”, “module”: “NodeNext”, “strict”: true, “noUncheckedIndexedAccess”: true, “outDir”: “dist” } }

Klíčový takeaway

strict: true od začátku. Interface pro objekty, type pro unie. Generics pro reusable kód.

typescriptprogrammingjavascript
Sdílet:

CORE SYSTEMS tým

Stavíme core systémy a AI agenty, které drží provoz. 15 let zkušeností s enterprise IT.