How to concat additional string with the typescript type definition object?

Solution 1:

You can do this with literal types the type utilities Record<Keys, Type> and Partial<Type>.

TS Playground

enum ConfigType {
  Value = 'Value',
  Value2 = 'Value2',
  Value3 = 'Value3',
  Value4 = 'Value4',
}

type Analog = Partial<Record<`${ConfigType}_key`, boolean>>;

/*

type Analog = {
  Value_key?: boolean;
  Value2_key?: boolean;
  Value3_key?: boolean;
  Value4_key?: boolean;
}

*/