Вместо использования "extends" в типе сигнатуры функции
export function createQueryWithSubscription<TMutationVariables extends {commandId: string}>(
вы должны объединить объявления следующим образом:
type TMutationVariablesWithCommandId = TMutationVariables & {commandId: string};
export function createQueryWithSubscription<TMutationVariablesWithCommandId>(
Playground Link