Spot the bug in the command registry

from satisfies operator
TypeScript 6 intermediate 4 min 2 issues to find

Find why this generated command registry fails to guarantee the declared command set.

TypeScript
type Command = { label: string; run(): void };
type CommandName = "build" | "deploy";

const commands = {
  build: { label: "Build", run: () => console.log("building") },
  delpoy: { label: "Deploy", run: () => console.log("deploying") },
} satisfies Record<string, Command>;

function execute(name: CommandName): void {
  commands[name].run();
}

execute("deploy");
Open in playground
Report an error