8 cards57 people studying this

TypeScript Advanced

Advanced TypeScript — generics, utility types, discriminated unions, and type-level programming.

Share on XWhatsApp
Study this deck for free

Free account includes unlimited cards, FSRS v6 scheduling, and AI card generation.
No credit card required.

Try it — tap the card
What are generics in TypeScript?
92% likely forgotten
Tap to see the answer
Type parameters that make functions/classes work with any type while preserving type safety. Example: function identity<T>(arg: T): T { return arg; }
Tap to flip back
What is the difference between "type" and "interface"?
Last reviewed 12 days ago
Tap to see the answer
Interface: extendable, declaration merging, best for object shapes. Type: can represent unions, intersections, primitives, tuples. Interfaces are often preferred for public APIs.
Tap to flip back
What is a discriminated union?
87% likely forgotten
Tap to see the answer
A union type where each member has a common literal property (discriminant). Enables exhaustive type narrowing in switch statements. Example: type Shape = Circle | Square.
Tap to flip back
What is the "infer" keyword?
Fading — due 5 days ago
Tap to see the answer
Used in conditional types to extract a type. Example: type ReturnType<T> = T extends (...args: any[]) => infer R ? R : never; Infers the return type R.
Tap to flip back
What are Partial<T>, Required<T>, Pick<T,K>, Omit<T,K>?
79% likely forgotten
Tap to see the answer
Utility types: Partial makes all properties optional. Required makes all required. Pick selects specific keys. Omit excludes specific keys.
Tap to flip back
What is "as const" assertion?
Last reviewed 21 days ago
Tap to see the answer
Makes values deeply readonly and narrows literal types. const colors = ["red", "blue"] as const; // readonly ["red", "blue"] instead of string[].
Tap to flip back
What is a mapped type?
94% likely forgotten
Tap to see the answer
Creates new types by transforming properties of existing types. Syntax: { [K in keyof T]: NewType }. Built-in examples: Readonly<T>, Record<K,V>.
Tap to flip back
What is "satisfies" in TypeScript?
Fading — due 9 days ago
Tap to see the answer
Validates a value matches a type without widening it. const config = { port: 3000 } satisfies Config; Keeps the literal type while checking compatibility.
Tap to flip back
Create your own AI flashcards

Create your own AI flashcards in 30 seconds — free

Get started for free

Want to track your progress with spaced repetition?

Sign up free to save this deck

Made with Forgetless — the AI flashcard app

Create your own deck in 30 seconds. Powered by the same algorithm as Anki.

Start free