[FSSDK-12115] Notification center type definition update by junaed-optimizely · Pull Request #1119 · optimizely/javascript-sdk
Summary
Notification center listener callback type definition update
Test plan
Existing tests should pass
Issues
- FSSDK-12115
| 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
| 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];
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters