-
Notifications
You must be signed in to change notification settings - Fork 19.7k
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(types) Export cbs and their parameter types #14871
Conversation
Thanks for your contribution! |
src/export/callback.ts
Outdated
@@ -0,0 +1,25 @@ | |||
import type { |
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.
Needs Apache License in the header.
IMO these callback types can be exported in the option
.
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.
Thanks for the feedback! I was considering putting them in there, but I initially wasn't sure how many exports I'd be adding and I didn't want to bloat that file too much. But I think this doesn't add too much bloat, although there are some more callbacks I didn't include as I wasn't sure exactly how they should be exported.
6aad0e3
to
9b08a0e
Compare
@pissang I have moved this PR to "awaiting review" from WIP, whenever you (or others) are ready to do a final/next review. Thank you again! |
src/util/types.ts
Outdated
@@ -1235,7 +1235,7 @@ type TooltipBoxLayoutOption = Pick< | |||
/** | |||
* Position relative to the hoverred element. Only available when trigger is item. | |||
*/ | |||
interface PositionCallback { | |||
export interface PositionCallback { |
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.
PositionCallback can be renamed to TooltipPositionCallback to avoid potential conflicts when exported
src/export/option.ts
Outdated
LabelLayoutOptionCallbackParams, | ||
LabelLayoutOptionCallback, | ||
PositionCallback |
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.
PositionCallback
is only used in the tooltip. So it can also be TooltipComponentPositionCallback
@pissang I believe I have addressed your comments. I also noticed some inconsistencies in my naming patterns and renamed a couple of the exports to be more consistent. Thank you very much |
Congratulations! Your PR has been merged. Thanks for your contribution! 👍 |
Brief Information
This pull request is in the type of:
What does this PR do?
Adds type exports for several callbacks and their parameters
Fixed issues
Details
Before: What was the problem?
It was difficult to implement properly types callback functions
After: How is it fixed in this PR?
It should now be possible to implement properly typed callbacks
Misc
Related test cases or examples to use the new APIs
As far as I could tell, there are no tests needed for type exports, but if I missed them, please let me know, and I will try to add them.
Others
Merging options
Other information