interface can be declared multiple times with the same name, and TypeScript will automatically merge their definitions together. A type alias cannot be redeclared once defined; attempting to do so will trigger a compile-time error.Preview terms and definitions before starting your study session.
interface can be declared multiple times with the same name, and TypeScript will automatically merge their definitions together. A type alias cannot be redeclared once defined; attempting to do so will trigger a compile-time error.interface extends other structures using the extends keyword (e.g., interface B extends A {}). A type alias extends other types using intersection operators (e.g., type B = A & { ... }). Unlike interfaces, type aliases can also directly represent primitives, unions, and tuples.Partial<T>Partial<T> constructs a type with all properties of T set to optional.type Partial<T> = {
[P in keyof T]?: T[P];
};Required<T>Required<T> constructs a type with all properties of T set to required. It explicitly removes the optional modifier using -?.type Required<T> = {
[P in keyof T]-?: T[P];
};Readonly<T>Readonly<T> constructs a type with all properties of T set to readonly. Reassigning properties of an object typed with Readonly<T> will cause a compile-time error.Pick<T, K>Pick<T, K> constructs a type by selecting a specified set of keys K from object type T.interface User {
id: number;
name: string;
email: string;
}
type UserSummary = Pick<User, 'id' | 'name'>;Omit<T, K>Omit<T, K> constructs a type with all properties of T except those listed in K.interface User {
id: number;
name: string;
passwordHash: string;
}
type PublicUser = Omit<User, 'passwordHash'>;Record<K, T>Record<K, T> constructs an object type whose property keys are K and whose property values are T. It maps a set of string or numeric literal keys to another type.type Role = 'admin' | 'user';
type Permissions = Record<Role, string[]>;Explore similar study materials created by the community
Master advanced TypeScript features like generics, conditional types, and mapped types to build robust, scalable applications. This deck covers essential utility types, type narrowing techniques, discriminated unions, and the nuances between interfaces and type aliases, empowering you to write highly maintainable and type-safe code.
Master key concepts in intermediate microeconomics with this comprehensive flashcard deck. Dive deep into game theory, market structures, strategic pricing, and general equilibrium models, perfect for Harvard ECON1011 students and anyone aiming to ace microeconomics.
Master MIT 18.03 Differential Equations with high-yield flashcards covering first and second-order ODEs, Laplace transforms, Fourier series, and matrix exponential state-space systems.
Master high-yield CPA FAR concepts covering ASC 606 revenue recognition, ASC 842 lease accounting, inventory valuation methods, and consolidated financial statements.