Step 3 / Select topic TypeScript Medium
What this bank covers
- let widens literal types
- const keeps literal types
- Array literals infer array types, not tuples
- Type argument inference from arguments
- Counting assignability errors
- const bindings vs mutable contents
- Object literal types are closed
- Property types widen inside object literals
- as const produces readonly tuples
- Property access on an un-narrowed union
- Discriminated union narrowing by literal property
- The `in` operator as a narrowing check
- Array.isArray narrows a string | string[] union
- User-defined type predicates
- Loose equality with null narrows out both null and undefined
- Assignment resets a narrowed type
- Truthiness narrowing also excludes the empty string
- Exhaustiveness checking with never
- Discriminated union narrowing in switch
- Unions and tuples need a type alias
- Merged interface requires every member
- Mapped types belong to type aliases
- extends checks compatibility, & does not
- Merging methods creates overloads
- Type aliases do not merge
- Interface declaration merging
- Interfaces cannot extend unions
- implements requires statically known members
- Generic function returning a composed object
- Indexed access return type T[K]
- Array type arguments are covariant
- Generic class with chained methods
- Constrained type parameter T extends { length: number }
- Default type parameter
- One type parameter shared by two parameters
- Generic key type with Map<K, number>
- Generic type predicate used with filter
- Unconstrained type parameters have no known members
- Record builds an object type from keys
- Pick keeps only the listed keys
- ReturnType captures a function's result type
- Exclude removes members from a union
- Partial makes every property optional
- Extract keeps the matching union members
- Parameters yields a tuple of argument types
- Record builds a fixed-key object type
- Readonly marks every property as readonly
- const vs let literal widening
- Object literal properties widen
- Literal types are erased at runtime
- as const produces literal tuple members
- Narrowing a numeric literal union
- as const implies readonly
- Template literal types
- Literal unions from a const object
- Literal inference under a string constraint
- Literal types and widening
- unknown is only assignable to unknown and any
- never is the bottom type
- never inference applies to function expressions, not declarations
- Narrowing unknown with type guards
- unknown blocks operators
- The never exhaustiveness trick
- never in intersections and arrays
- any silences checks but not runtime semantics
- Distributive conditional types over never
- Indexing unknown[] yields unknown
- Overriding with super
- Field initialization order
- Static members and inheritance
- Accessors
- Polymorphic method dispatch
- Arrow function class fields
- Parameter properties with defaults
- private versus protected members
- Calling an overridden method with super
- Numeric enum auto-increment
- const enum members inline as literals
- Reverse mappings in numeric enums
- Numeric enum reverse mapping
- String enums have no reverse mapping
- Enum auto-increment after explicit values
- String enum members behave like strings
- keyof typeof an enum
- const enums have no runtime object
- A type assertion is compile-time only
- Enums survive compilation
- Interfaces have no runtime value
- Non-null assertion is not a runtime check
- `any` disables the compile-time check only
- `satisfies` checks without changing the value
- Abstract classes still emit a value
- `private` is enforced only by the compiler
- `readonly` is not frozen at run time
- Annotations do not validate external data
- as const blocks literal widening
- Interfaces cannot extend union type aliases
- Partial, Required, Readonly and Pick in one snippet
- Overriding a method and calling super
- Numeric enum auto-increment and reverse mapping