Type Alias: CmcdData
ts
type CmcdData = CmcdV1Data | CmcdV2Data;Defined in: CmcdData.ts:48
A CMCD data object that is either version 1 or version 2.
The v property is the discriminator:
- When
vis2, the type narrows to CmcdV2Data with inner-list values and event/response keys. - When
vis1or absent, the type narrows to CmcdV1Data with scalar values.
Example
ts
function process(data: CmcdData) {
if (data.v === 2) {
// data.bl is CmcdObjectTypeList | undefined
} else {
// data.bl is number | undefined
}
}