amazon-connect / amazon-connect-streams

Amazon Connect Streams - a browser-based contact center integration API, typically with CRM systems.
https://docs.aws.amazon.com/connect/latest/userguide/
Apache License 2.0
394 stars 315 forks source link

index.d.ts: missing `connect.core.getEventBus()` declaration #934

Open mfulton26 opened 1 month ago

mfulton26 commented 1 month ago

Documentation.md mentions a getEventBus() method on connect.core but index.d.ts does not declare one. May one be added please so that consumers using TypeScript don't need to cast connect.core in order to access the method?

My current workaround (although I'm not confident I've structured the types completely or not):

import "amazon-connect-streams";

interface EventBus {
    subscribe: (eventType: connect.EventType, callback: connect.Callback) => connect.Subscription;
}

const core = connect.core as typeof connect.core & { getEventBus: () => EventBus };
const eventBus = core.getEventBus();
intptr-t commented 6 days ago

I created a Pull request(Issue) in the past, but it was not reviewed. It is likely that it will not be officially implemented for a while, so the only way to work around it is to use a Type Assertion like the one you wrote.