Open this example in the interactive library
Source code
type Settings = { theme: string; limit: number; debug: boolean };
const settings: Settings = { theme: "dark", limit: 4, debug: false };
console.log(
(
{
theme: () => settings.theme,
limit: () => settings.limit,
debug: () => settings.debug,
} satisfies { [K in keyof Settings]: () => Settings[K] }
).limit(),
);
Sample output
4
