@dmgt/google-ad-manager-api
Version:
Typed Google Ad Manager API
29 lines (26 loc) • 452 B
text/typescript
export interface Value<K extends string, V = any> {
key: K
value: {
attributes: {
'xsi:type': string
}
value: V
}
}
export type ValueKey<V extends Value<string>> =
V extends Value<infer Key> ? Key : never
export function value<K extends string, V = any>(
key: K,
type: string,
value: V,
): Value<K, V> {
return {
key,
value: {
attributes: {
'xsi:type': type,
},
value,
},
}
}