Pure Ts Tour -
// Generic constraint function getLength<T extends length: number >(item: T): number return item.length;
interface Todo title: string; description: string; completed: boolean;
// Arrays let fruits: string[] = ["apple", "banana"]; let numbers: Array<number> = [1, 2, 3]; // Tuples (fixed length, typed positions) let person: [string, number] = ["John", 25]; person.push("extra"); // ⚠️ allowed but avoid – TS limitation pure ts tour
Create folder structure:
// Pick / Omit type ShortTodo = Pick<Todo, "title" | "completed">; type NoDesc = Omit<Todo, "description">; // Generic constraint function getLength<
// Interface interface User readonly id: number; // cannot change after init name: string; email?: string; // optional
console.log(identity("hello")); console.log(getLength([1, 2, 3])); src/features/7-type-narrowing.ts T extends length: number >
// Explicit typing let username: string = "Alice"; let age: number = 30; let isActive: boolean = true; // Type inference (hover to see TS inferred type) let city = "Paris"; // string let score = 99.5; // number
