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

Fix: Use callback declaration from types #83

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

epikoder
Copy link

PaystackConsumer and PaystackContext are using () =>void for onSuccess instead of callback from types

@Nelwhix
Copy link
Contributor

Nelwhix commented Jul 8, 2023

I was even thinking, for better typesafety, The type should be (reference: string) => void. What do you think?

@epikoder
Copy link
Author

While it’s good won’t it break changes with existing implementation?
reference is always part of response (response?: any) => void
And response is hardly ever undefined on success, and the type any can accommodate future changes. since paystack api won’t be changing anytime soon

type Response = {
      /** known fields**/,
      [key:string]: string // maybe :any
}
type callback = (response: Response) => void

this maintain the current implementation ans provide typing to linters

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

Successfully merging this pull request may close these issues.

2 participants