_CORE
AI & Agentic Systems Core Information Systems Cloud & Platform Engineering Data Platform & Integration Security & Compliance QA, Testing & Observability IoT, Automation & Robotics Mobile & Digital Banking & Finance Insurance Public Administration Defense & Security Healthcare Energy & Utilities Telco & Media Manufacturing Logistics & E-commerce Retail & Loyalty
References Technologies Blog Know-how Tools
About Collaboration Careers
CS EN
Let's talk

TypeScript od nuly

14. 09. 2019 1 min read 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” } }

Key Takeaway

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

typescriptprogrammingjavascript
Share:

CORE SYSTEMS tým

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