@@ -120,13 +120,7 @@ export interface ListenerPayload {
120120 attributes ?: UserAttributes ;
121121}
122122
123- export type DecisionNotificationType =
124- | typeof DECISION_NOTIFICATION_TYPES . AB_TEST
125- | typeof DECISION_NOTIFICATION_TYPES . FEATURE
126- | typeof DECISION_NOTIFICATION_TYPES . FEATURE_TEST
127- | typeof DECISION_NOTIFICATION_TYPES . FEATURE_VARIABLE
128- | typeof DECISION_NOTIFICATION_TYPES . ALL_FEATURE_VARIABLES
129- | typeof DECISION_NOTIFICATION_TYPES . FLAG ;
123+ export type DecisionNotificationType = typeof DECISION_NOTIFICATION_TYPES [ keyof typeof DECISION_NOTIFICATION_TYPES ] ;
130124
131125export type DecisionSource =
132126 | typeof DECISION_SOURCES . FEATURE_TEST
@@ -215,11 +209,11 @@ export type NotificationPayloadMap = {
215209 [ NOTIFICATION_TYPES . OPTIMIZELY_CONFIG_UPDATE ] : undefined ;
216210} ;
217211
218- export type NotificationListener < T > = ( notificationData : T ) => void ;
212+ export type NotificationListener < T extends ListenerPayload > = ( notificationData : T ) => void ;
219213export interface NotificationCenter {
220- addNotificationListener < K extends keyof NotificationPayloadMap > (
221- notificationType : K ,
222- callback : NotificationListener < NotificationPayloadMap [ K ] >
214+ addNotificationListener < T extends ListenerPayload > (
215+ notificationType : string ,
216+ callback : NotificationListener < T >
223217 ) : number ;
224218 removeNotificationListener ( listenerId : number ) : boolean ;
225219 clearAllNotificationListeners ( ) : void ;
@@ -478,14 +472,14 @@ export interface Client {
478472}
479473
480474export interface ActivateListenerPayload extends ListenerPayload {
481- experiment ? : import ( './shared_types' ) . Experiment ;
482- variation ? : import ( './shared_types' ) . Variation ;
475+ experiment : import ( './shared_types' ) . Experiment ;
476+ variation : import ( './shared_types' ) . Variation ;
483477 logEvent : Event ;
484478}
485479
486480export interface TrackListenerPayload extends ListenerPayload {
487481 eventKey : string ;
488- eventTags ? : EventTags ;
482+ eventTags : EventTags ;
489483 logEvent : Event ;
490484}
491485
0 commit comments