Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript typings prevent data from being passed to event listeners #44

Open
aechan opened this issue Mar 25, 2021 · 2 comments
Open

Comments

@aechan
Copy link

aechan commented Mar 25, 2021

We are using the library with the Typescript types provided in this repository.

In your docs, you give this as an example of how to listen for errors:

GlobalPayments.on("error", (error) => {
  console.error(error);
});

The issue is that, the .on function is defined as:

on: (ev: string, listener: IEventListener) => void;

and IEventListener is defined as:

export declare type IEventListener = () => void;

So this type dictates that no data should be passed through an event listener.

I know that the code is actually passing the data through these listeners, but this mis-typing prevents our Typescript project from compiling without explicitly ignoring typings for the .on function.

@slogsdon
Copy link
Contributor

Thanks for bringing this to our attention, @aechan. I'll work with the team to improve the types here.

@reubenoxara
Copy link

this is still an issue for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants