Skip to content
tezvyn:

TypeScript & Web APIs

TypeScript, browser APIs, WebAssembly, PWAs

121 bites

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

Intermediate everything in TypeScript & Web APIs, page 2

intermediate2 min read

How do you type a custom property on global window in TypeScript?

Tests declaration merging and global scope augmentation in TypeScript. Strong answer: declare global in a .ts file, a .d.ts with interface Window, or scoped declare const window. Red flag: any or ts-ignore instead of interface merging.

intermediate2 min read

How do you globally add a property to a third-party ButtonProps interface?

Tests TypeScript declaration merging and module augmentation. A strong answer uses a .d.ts file that declares the same module and interface name to merge the missing property globally. Red flag: suggesting edits inside node_modules or local wrapper types.

intermediate2 min read

How would you structure TypeScript code and exports for effective tree-shaking?

Tests ES module semantics and sideEffects for library authors. Great answers: emit ESM, set sideEffects:false, avoid stateful barrel files, and preserve import syntax. Red flag: saying ESM alone guarantees tree-shaking without mentioning side effects.

How do modern build tools handle TypeScript vs tsc?
intermediate2 min read

How do modern build tools handle TypeScript vs tsc?

Separating transpilation from type checking for speed. Great answer: fast native tooling strips TS per-file on demand via native ESM; browser loads only visited modules; tsc/ts-loader check/bundle the whole graph upfront.

intermediate2 min read

What problem does esModuleInterop solve for CommonJS imports?

Tests CommonJS-to-ESM interop. A strong answer covers: default imports for CommonJS modules; runtime helpers checking __esModule and wrapping exports; and implicit allowSyntheticDefaultImports. Red flag: claiming it is purely type-level with no emit impact.

intermediate2 min read

How would you use tsconfig.json to enable shorter path aliases?

This tests TypeScript module resolution. A strong answer sets compilerOptions.baseUrl, maps paths like @/* to src/*, and warns bundlers need matching aliases. A red flag is omitting baseUrl or claiming paths alone changes runtime resolution.

Use MediaRecorder to capture a canvas stream and download as WebM
intermediate2 min read

Use MediaRecorder to capture a canvas stream and download as WebM

Tests MediaRecorder lifecycle and blob assembly. Answer: canvas.captureStream() into new MediaRecorder with video/webm, start(), collect chunks via dataavailable, stop(), then build a Blob and object URL for download.

Explain the roles of vertex and fragment shaders in WebGL
intermediate2 min read

Explain the roles of vertex and fragment shaders in WebGL

Vertex shaders write gl_Position per vertex; fragment shaders write gl_FragColor per pixel.

Which video event signals completion, and how do you track playback time?
intermediate2 min read

Which video event signals completion, and how do you track playback time?

Tests HTMLMediaElement events and UI performance. Answer: use ended for replay; read currentTime on timeupdate but throttle updates or use requestAnimationFrame. Red flag: setInterval polling, currentTime===duration checks, or unthrottled state writes.

How do you create a smooth Canvas 2D loop with requestAnimationFrame?
intermediate2 min read

How do you create a smooth Canvas 2D loop with requestAnimationFrame?

Tests render pipeline timing. Outline: queue rAF per refresh; derive delta from timestamp for frame-rate independence; recurse each frame; cancel via cancelAnimationFrame. Red flag: claiming rAF locks 60fps, ignoring timestamp, or setInterval is fine.

Explain Network First vs Cache First caching and when to use each
intermediate2 min read

Explain Network First vs Cache First caching and when to use each

Tests matching caching strategy to asset freshness. Cache First serves static assets from the Cache API, falling back to network. Network First fetches fresh content, falling back to cache offline.

Describe the Service Worker lifecycle and cache versioning
intermediate2 min read

Describe the Service Worker lifecycle and cache versioning

Tests your grasp of the Service Worker lifecycle and cache versioning. A strong answer sequences register, install, activate, and fetch; notes install precaches assets while activate purges old caches and finalizes takeover.

Pass data to a Web Worker and transfer an ArrayBuffer efficiently
intermediate2 min read

Pass data to a Web Worker and transfer an ArrayBuffer efficiently

Tests postMessage clone versus transferable objects for zero-copy transfer. Good answers note postMessage copies by default, but ArrayBuffer can move via transfer list, neutering the original.

SPA back button: what event fires and how do you handle it?
intermediate2 min read

SPA back button: what event fires and how do you handle it?

Tests History API literacy. Strong answer: popstate event, PopStateEvent type, restore UI via event.state, and zero-delay setTimeout for DOM sync. Red flag: confusing popstate with pushState or using hashchange for modern History API routing.

Write an IndexedDB add function with transaction error handling
intermediate2 min read

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.

Explain IndexedDB transactions and readonly vs readwrite modes
intermediate2 min read

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.

intermediate2 min read

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.

What are localStorage's capacity and synchronous blocking limitations?
intermediate2 min read

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.

intermediate2 min read

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.

intermediate2 min read

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.

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