[FSSDK-12115] Notification center type definition update by junaed-optimizely · Pull Request #1119 · optimizely/javascript-sdk

@junaed-optimizely

Summary

Notification center listener callback type definition update

Test plan

Existing tests should pass

Issues

  • FSSDK-12115

@junaed-optimizely

@coveralls

Coverage Status

coverage: 90.348% (+0.001%) from 90.347%
when pulling 37c9675 on junaed/fssdk-12115-notification-center-type
into 34682ea on 5.x.x.

raju-opti

export interface TrackListenerPayload extends ListenerPayload {
eventKey: string;
eventTags: EventTags;
eventTags?: EventTags;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be a breaking change. Need to keep this type unchanged

export interface ActivateListenerPayload extends ListenerPayload {
experiment: import('./shared_types').Experiment;
variation: import('./shared_types').Variation;
experiment?: import('./shared_types').Experiment;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will be a breaking change. Need to keep this unchanged

};

export type NotificationListener<T> = (notificationData: T) => void;
export interface NotificationCenter {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot modify this interface, it would be a breaking change

addNotificationListener<T extends ListenerPayload>(
notificationType: string,
callback: NotificationListener<T>
addNotificationListener<K extends keyof NotificationPayloadMap>(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to keep this unchanged

@junaed-optimizely

raju-opti

export type NotificationListener<T extends ListenerPayload> = (notificationData: T) => void;
export type DecisionNotificationType = typeof DECISION_NOTIFICATION_TYPES[keyof typeof DECISION_NOTIFICATION_TYPES];

export type DecisionSource =

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we do type DecisionSource = typeof DECISION_SOURCES[keyof typeof DECISION_SOURCES];