export interface Value { key: K value: { attributes: { 'xsi:type': string } value: V } } export type ValueKey> = V extends Value ? Key : never export function value( key: K, type: string, value: V, ): Value { return { key, value: { attributes: { 'xsi:type': type, }, value, }, } }