-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
refactor: Transform URLShortLinkModal to Typescript #11971
refactor: Transform URLShortLinkModal to Typescript #11971
Conversation
Codecov Report
@@ Coverage Diff @@
## master #11971 +/- ##
==========================================
- Coverage 63.75% 54.37% -9.38%
==========================================
Files 941 432 -509
Lines 45654 15250 -30404
Branches 4389 3891 -498
==========================================
- Hits 29106 8292 -20814
+ Misses 16371 6958 -9413
+ Partials 177 0 -177
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
@etr2460 🙏 |
emailContent?: string; | ||
title?: string; | ||
addDangerToast: (msg: string) => void; | ||
triggerNode: JSX.Element; |
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.
any reason for JSX.Element
and not React.ReactNode
?
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.
what are the differences? I checked and it's not clear
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.
ReactNode includes JSX.Element (an alias of ReactElement<any, any>), as well as string, null, undefined and node arrays.
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.
In this case it’s probably better to use JSX.Element since you’d want the trigger element to always exist and not be a text node.
> { | ||
static defaultProps = { | ||
url: window.location.href.substring(window.location.origin.length), | ||
emailSubject: '', |
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.
if we default this to empty string, can we make the props type themselves non-undefined? Or maybe get rid of the empty string default val
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.
changed!
SUMMARY
Transform URLShortLinkModal to Typescript