Skip to content

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