All bites
The whole library, newest first. Filter by what you are here for, or pick a topic if you already know.
4330 bites
Page 189
Implement a generic PickByType<T, U> utility type
Tests mapped-type key filtering via conditional types and as remapping. Great answer: [K in keyof T as T[K] extends U ? K : never]: T[K]. Red flag: mapping all keys and setting values to never, which preserves keys instead of removing them.
Explain Pick versus Omit with User examples
Pick keeps listed keys; Omit drops them. Show User with id, name, email; derive Pick<User,"name"|"email"> and Omit<User,"id">.
Describe a common use for Partial<T> and explain Required<T>
Partial fits PATCH updates where only some fields arrive; Required strips optionality to enforce all properties.
Create a User type alias from a function return type
Use typeof to grab the function type, then ReturnType to extract the return object shape.
Write a generic MakeOptional<T> mapped type without using Partial
This tests mapped type mechanics and the optionality modifier. A strong answer iterates over keyof T, adds the ? modifier, and preserves the original type via indexed access. A red flag is suggesting Object.assign or saying you would just use Partial.
Create TerminalStatus from Status using Exclude or Extract
This tests conditional type mechanics and whitelist versus blacklist thinking. Extract selects matches by assignability; Exclude removes others. Prefer Extract when the desired set is explicit. Red flag: claiming they are equivalent or only knowing Exclude.
Implement MyParameters<T> using conditional types and infer
Tests if you can extract parameter types with infer. A strong answer matches T against a callable signature, uses infer to bind parameters into a tuple, and defaults to never for non-functions. Red flag: using any or indexing without inference.
Implement the built-in NonNullable<T> utility type from scratch
Tests conditional type distribution and union filtering. A strong answer uses distributive conditional types to map null and undefined to never while preserving other union members.
Write a generic PickByValue<T, V> type
Tests conditional types and mapped-type key remapping. Great answer: K in keyof T as T[K] extends V ? K : never with value T[K]. Red flag: writing V extends T[K] instead, which reverses the assignability check and includes wrong keys.
Implement recursive DeepReadonly<T> for nested objects and arrays
Tests recursive mapped types and conditional type narrowing. A strong answer uses a conditional to split arrays into ReadonlyArray, objects into readonly mapped types, and leaves primitives untouched.
Write a generic CreateSetters<T> that maps properties to setter methods
This tests TypeScript mapped types with key remapping and template literals. It iterates keyof T, remaps via as set plus Capitalize of string and K, and types values as setter methods. Red flag: manually typing setters or omitting string and K in Capitalize.

What is the core difference between localStorage and sessionStorage?
SessionStorage dies with its tab; localStorage survives restarts and shares across tabs. Example: checkout form versus theme preference.

How do you store and retrieve a TypeScript object in localStorage?
This tests your knowledge of Web Storage string constraints and JSON serialization. A strong answer covers JSON.stringify on write, JSON.parse on read, and typing the result with a TypeScript interface.

What are localStorage's capacity and synchronous blocking limitations?
This tests Web Storage API trade-offs and main-thread blocking. A strong answer notes synchronous calls block the main thread; cites a finite per-origin quota; and names IndexedDB for async needs. Red flag: calling it a database or ignoring UI freezes.
Design a type-safe generic localStorage wrapper in TypeScript
Generic getItem<T> returns T|null via JSON.parse, setItem<T> stringifies, and a key-to-type map enforces safety.

Explain IndexedDB transactions and readonly vs readwrite modes
Every operation needs a transaction; readonly allows concurrent readers, readwrite is exclusive; they auto-commit when idle.

Write an IndexedDB add function with transaction error handling
Tests IndexedDB request-transaction lifecycle and event-driven error propagation. Answers open a transaction, call add(), and wire onsuccess/onerror on the request plus onabort/onerror on the transaction. Red flag: ignoring onabort or duplicate-key throws.

How do you add a new index to an existing IndexedDB store?
Tests production schema migration discipline. Bump the integer version in open(), handle onupgradeneeded before onsuccess, use event.oldVersion for incremental changes, and guard against duplicate index creation.

How do you query IndexedDB products by price range?
Tests IndexedDB indexing and range query APIs. You need a price index created in onupgradeneeded, then IDBKeyRange.bound(50, 100) with index.getAll or openCursor. Red flag: fetching all records and filtering in JavaScript.

Why access IndexedDB exclusively from a Web Worker?
Tests whether you know IndexedDB in workers keeps the main thread free from serialization and transaction overhead, while recognizing that postMessage copying and request-response coordination add real architectural complexity.