A readonly tuple of keys plus typeof KEYS[number] yields a union of those keys. Use it to build a Record<Key, number> and initialize counts. This ties a runtime list directly to a static type.
const KEYS = ["todo", "done"] as const;
type Key = (typeof KEYS)[number]; // 'todo' | 'done'Initialize all counts to zero.
Create a count map from a const tuple of statuses.
const STATUSES = ['todo', 'doing', 'done'] as const.type Status = typeof STATUSES[number].initCounts(): Record<Status, number> that returns an object with those keys set to 0.STATUSES.