-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[TypeScript] Fix onSuccess / onFailure types #5853
Conversation
export type OnSuccess = (response?: any) => void; | ||
export type OnFailure = (error?: any) => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably avoid any
in favor of unknow
. See #5834
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand the benefits and shortcomings of any
vs unknown
. What I've read at https://stackoverflow.com/questions/51439843/unknown-vs-any tells me that there may be drawbacks for end users (like the obligation to perform type checking on an unknown value before using it).
Let's keep the two discussions separate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an eslint warning ;)
Additionally, the main fix for #5761 is missing: |
No, |
@djhi I guess the main problem here is that there exists at least 3 different kind of onSuccess properties, which expect different types, but are all using the same OnSuccess type. Plz check my issue: In the onCreateController, it need to be of the type I have mentioned above. So at least the type there should be changed. |
@HendrikRoehm You said:
What do you mean? Do you have a compilation error? If so, with which code? Also, it's only in dataProvider.create() that the onsuccess callback can expect a defined response with a data key. |
Closes #5761
Supersedes #5787