Skip to content
tezvyn:

TypeScript & Web APIs

TypeScript, browser APIs, WebAssembly, PWAs

67 bites

Test yourself: Top 30 advanced TypeScript & Web APIs interview questionsMultiple choice, with the correct answer and why it is correct on every question. Free, no sign-in.

Advanced everything in TypeScript & Web APIs, page 3

Runtime Response Validation with Schema Libraries
advanced2 min read

Runtime Response Validation with Schema Libraries

TypeScript types evaporate at runtime, so a fetch response typed as User[] can be null or malformed. Schema libraries like Zod give static types and runtime guards from one contract. The footgun is using as instead of parse, silently reintroducing crashes.

advanced2 min read

TypeScript Namespaces: The Original Module System

TypeScript namespaces bundle related code under a single global name, preventing name collisions. They are useful for older projects or UMD library types, but the footgun is using them in modern apps; prefer standard ES modules.

advanced2 min read

Speed Up Builds with TypeScript Project References

Treat your codebase like a set of independent packages. Project References let you split a large project into smaller, interconnected pieces, dramatically speeding up builds by only recompiling what's changed.

Media Source Extensions: The Engine for Web Streaming
advanced2 min read

Media Source Extensions: The Engine for Web Streaming

MSE lets you build streaming video players in JavaScript by feeding media chunks to a <video> element, instead of a single file URL. It's the foundation for adaptive streaming like DASH/HLS.

RTCPeerConnection: Direct Browser-to-Browser Links
advanced2 min read

RTCPeerConnection: Direct Browser-to-Browser Links

Think of an RTCPeerConnection as a direct phone line between two browsers. It's the core of WebRTC, enabling peer-to-peer video and data streams. The footgun: it doesn't find peers; you must use a separate signaling server to broker the initial handshake.

WebGL Textures: From Image File to GPU Pixels
advanced2 min read

WebGL Textures: From Image File to GPU Pixels

WebGL textures are images uploaded to the GPU for fast access when "painting" 3D models. They're used to apply detailed surfaces like brick patterns. The footgun: images must be CORS-approved, and non-power-of-two dimensions break mipmapping in WebGL1.

Web Audio API: A Modular Synth for Your Browser
advanced2 min read

Web Audio API: A Modular Synth for Your Browser

The Web Audio API treats sound as a modular graph. You connect sources (files, oscillators) to effects (filters) and a destination (speakers) for precise, low-latency control. It's ideal for games and music apps.

Web Push API: Engage Users When Your App is Closed
advanced2 min read

Web Push API: Engage Users When Your App is Closed

The Web Push API lets servers send messages to users even when your site is closed. A service worker receives these pushes, making it ideal for notifications. The main footgun: the subscription endpoint is a secret key that must be protected.

Background Sync API: Send Data When the Network Returns
advanced2 min read

Background Sync API: Send Data When the Network Returns

The Background Sync API lets your app defer work until the network is back. You register a task, and the browser wakes your service worker to run it when connectivity returns. Use it to reliably send data submitted while offline, like form posts or chat.

Transferable Objects: Zero-Copy Data for Web Workers
advanced2 min read

Transferable Objects: Zero-Copy Data for Web Workers

Transferable Objects move resource ownership between contexts, like threads, instead of copying data. This enables fast, 'zero-copy' transfers for large memory blocks. Use it with postMessage() to send an ArrayBuffer to a Web Worker.

Shared Workers: One Background Script for Multiple Tabs
advanced2 min read

Shared Workers: One Background Script for Multiple Tabs

A SharedWorker is a single background script shared across multiple tabs or windows from the same origin. Use it to manage a single WebSocket connection or sync state between pages. The footgun: each tab must call port.start() on its own message port.

Cache API: Manual Control Over Network Responses
advanced2 min read

Cache API: Manual Control Over Network Responses

The Cache API is a key-value store for network requests you control directly, unlike the browser's automatic HTTP cache. Use it in service workers for offline support or to pre-cache app assets.

IndexedDB Versioning: The 'upgradeneeded' Gatekeeper
advanced2 min read

IndexedDB Versioning: The 'upgradeneeded' Gatekeeper

IndexedDB uses a version number to manage schema changes. Incrementing the version in indexedDB.open() triggers a special upgradeneeded event, which is the only context where you can create or modify object stores and indexes.

IndexedDB Cursors: Iterate Large Datasets Efficiently
advanced2 min read

IndexedDB Cursors: Iterate Large Datasets Efficiently

An IndexedDB cursor is a pointer for walking through records one by one, avoiding loading a whole dataset into memory. Use it to efficiently process large browser databases.

IndexedDB Indexes: Fast Queries in the Browser
advanced2 min read

IndexedDB Indexes: Fast Queries in the Browser

An IndexedDB index is like a book's index, letting you quickly find records by a specific property without scanning the entire dataset. It's essential for fast queries on non-primary keys, like looking up a user by email.

Variadic Tuple Types: Type-Safe Spreads for Tuples
advanced2 min read

Variadic Tuple Types: Type-Safe Spreads for Tuples

Variadic tuple types let you use spread syntax (...) inside tuple type definitions, just like you do with array values. This is crucial for typing functions that manipulate tuples, like concat, without writing endless overloads or losing type information.

Stream a Fetch Response Chunk by Chunk
advanced2 min read

Stream a Fetch Response Chunk by Chunk

Process a fetch response as it arrives, chunk by chunk, instead of buffering the whole file in memory. This is ideal for large files like videos or giant JSON datasets.

The Fetch API's Request Object
advanced2 min read

The Fetch API's Request Object

The Fetch API's Request object is a blueprint for an HTTP call, bundling URL, method, headers, and body. It's key for intercepting traffic in service workers or building reusable fetches. The main footgun: its body is a stream that can only be read once.

Promise Cleanup with .finally()
advanced2 min read

Promise Cleanup with .finally()

Promise.finally() is the try...catch...finally for async code, guaranteeing logic runs after a promise settles. Use it to hide a loading spinner or close a network connection without duplicating code in .then() and .catch().

currentTarget vs. target: Who's Listening vs. Who Shouted
advanced2 min read

currentTarget vs. target: Who's Listening vs. Who Shouted

event.currentTarget is the element listening for an event, while event.target is the element that triggered it. This is vital for event delegation patterns. Be careful: currentTarget is only valid inside the handler and becomes null afterward.

We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.

See open roles