-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
QuestionAn issue which isn't directly actionable in codeAn issue which isn't directly actionable in code
Description
The below code has a specialized signature for Subscribe function that takes "NotificationClicked" as the event Name and NotificationClickedEventArgs type as the eventArgs parameter. The general signature takes any string as eventName and the base EventArgs as the eventArgs parameter.
My understanding is that typescript should give a compiler error where I am executing the code PublishSubscribe.Subscribe("NotificationClicked", new EventArgs()); because the specialized signature expects a NotificationClickedEventArgs type. As per my observation, typescript is compiling successfully which most likely is a bug. This works correctly on return types though.
class EventArgs{
EventName: string;
EventData: any;
}
class NotificationClickedEventArgs extends EventArgs{
NotificationID: string;
}
class PublishSubscribe{
static Subscribe:{
(eventName: "NotificationClicked", eventArgs: NotificationClickedEventArgs):void;
(eventName: string, eventArgs :EventArgs):void;
} = (eventName: string, eventArgs: EventArgs) => { }
}
PublishSubscribe.Subscribe("NotificationClicked", new EventArgs());
Metadata
Metadata
Assignees
Labels
QuestionAn issue which isn't directly actionable in codeAn issue which isn't directly actionable in code