IK
Interview Knowledge Book
Topics
Practice
Examples
Playground
RU
browser
satisfies-style config table
Use a precise config table while preserving literal keys and validating the expected shape.
index.js
/** * TypeScript version: * const routes = { ... } satisfies Record<string, { path: string }>; * keyof typeof routes remains 'api' | 'admin'. */ const routes = { api: { path: '/v1' }, admin: { path: '/admin' }, }; for (const key of Object.keys(routes)) { console.log(`${key} -> ${routes[key].path}`); }
Run
Stop
Reset