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

Create prop onSuccess has wrong typing #5761

Closed
HendrikRoehm opened this issue Jan 11, 2021 · 3 comments · Fixed by #5853
Closed

Create prop onSuccess has wrong typing #5761

HendrikRoehm opened this issue Jan 11, 2021 · 3 comments · Fixed by #5853
Assignees
Labels

Comments

@HendrikRoehm
Copy link

According to the CreateProps typings, the onSuccess callback has the type (data: Record) => void.

However, it seems that the true implementation in the useCreateController the type ({ data } : { data: Record}) => void is used.

Right now the two are incompatible. I would suggest to change the type as this breaks no implementation based on the current behaviour?

@fzaninotto fzaninotto added the bug label Jan 14, 2021
@fzaninotto
Copy link
Member

Very well spotted! It is indeed a bug. Would you like to open a PR to patch the types?

@HendrikRoehm
Copy link
Author

Sure, I will create a PR.

@HendrikRoehm
Copy link
Author

I have opened a pull-request. During my investigation in the code, it seems that there a minimum of 3 different usages of an onSuccess property in different locations. Additionally, there were a lot of locations where basically no typing was present (everything was any). I tried to remove some abiguity by defining more types.

I was not quite sure how to test that, so I am happy for suggestions on how to improve the PR.

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