Type template literals, utility types, and operators
To pull it all together, I'll sometimes use a technique like this to make my life easier.
type User = {
firstName: string;
lastName: string;
age: number;
};
type ActionTypes = `update-${keyof User}`;
type Actions<T, K extends keyof T & string> = {
type: `update-${K}`;
payload: T[K];
};
type UpdateNameAction = Actions<User, 'firstName'>;
You can see it in action here.