@@ -25,6 +25,9 @@ import { DynamicConfig, DataLayer, Gtag, MinimalDynamicConfig } from './types';
25
25
import { GtagCommand , GTAG_URL } from './constants' ;
26
26
import { logger } from './logger' ;
27
27
28
+ // Possible parameter types for gtag 'event' and 'config' commands
29
+ type GtagConfigOrEventParams = ControlParams & EventParams & CustomParams ;
30
+
28
31
/**
29
32
* Makeshift polyfill for Promise.allSettled(). Resolves when all promises
30
33
* have either resolved or rejected.
@@ -226,8 +229,7 @@ function wrapGtag(
226
229
async function gtagWrapper (
227
230
command : 'config' | 'set' | 'event' | 'consent' ,
228
231
idOrNameOrParams : string | ControlParams ,
229
- // TODO(dwyfrequency)Unsure if this is the best path.
230
- gtagParams ?: GtagSetConfigEventParams | ConsentSettings
232
+ gtagParams ?: GtagConfigOrEventParams | ConsentSettings
231
233
) : Promise < void > {
232
234
try {
233
235
// If event, check that relevant initialization promises have completed.
@@ -238,7 +240,7 @@ function wrapGtag(
238
240
initializationPromisesMap ,
239
241
dynamicConfigPromisesList ,
240
242
idOrNameOrParams as string ,
241
- gtagParams as GtagSetConfigEventParams
243
+ gtagParams as GtagConfigOrEventParams
242
244
) ;
243
245
} else if ( command === GtagCommand . CONFIG ) {
244
246
// If CONFIG, second arg must be measurementId.
@@ -248,7 +250,7 @@ function wrapGtag(
248
250
dynamicConfigPromisesList ,
249
251
measurementIdToAppId ,
250
252
idOrNameOrParams as string ,
251
- gtagParams as GtagSetConfigEventParams
253
+ gtagParams as GtagConfigOrEventParams
252
254
) ;
253
255
} else if ( command === GtagCommand . CONSENT ) {
254
256
// If CONFIG, second arg must be measurementId.
@@ -263,8 +265,6 @@ function wrapGtag(
263
265
}
264
266
return gtagWrapper as Gtag ;
265
267
}
266
- // TODO(dwyfrequency)Unsure if this is the best path and where it should go. Probably the type file
267
- type GtagSetConfigEventParams = ControlParams & EventParams & CustomParams ;
268
268
269
269
/**
270
270
* Creates global gtag function or wraps existing one if found.
0 commit comments