-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
[RFR] rewrite RichTextInput to TypeScript #4223
Conversation
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 great work.
Just remove the any from the stylesheet, and convert numeric string to number, and this will be all good.
@ThieryMichel done |
Thanks! I forgot to ask that you PR against the |
847782c
to
b4fa210
Compare
@@ -123,20 +157,13 @@ const RichTextInput = ({ | |||
); | |||
}; | |||
|
|||
RichTextInput.propTypes = { |
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.
need to keep the propTypes
. Compile-time type validation doesn't replace runtime type checking (unfortunately). Would you mind adding these back?
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.
👍
]), | ||
fullWidth: PropTypes.bool, | ||
configureQuill: PropTypes.func, | ||
RichTextInput.defaultProps = { |
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.
Please keep these as default values for the props instead, React is deprecating defaultProps
for function components (facebook/react#16210).
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.
👍
b4fa210
to
5430e6e
Compare
@@ -125,14 +160,6 @@ RichTextInput.propTypes = { | |||
label: PropTypes.string, | |||
options: PropTypes.object, | |||
source: PropTypes.string, | |||
toolbar: PropTypes.oneOfType([ |
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 removed that because Quill
should validate it's options itself, IMO it's a good practice because leaving that breaks the composition.
Thanks! |
Hi, I found that you need help with rewriting the project to TypeScript.
I'm not sure about removing the
prop-types
dependency, but the TypeScript is here so IMO it is not needed anymore, leave a comment if you have opposite opinion so I'll restore it.Instead of default values in object spread I've added
defaultProps
, also - the full object of props is passed touseStyles
hook.From minor things - I had to cast the styles (*Stylsheet file) object to
any
because apparently the object is of invalid type (eg. numeric string is used instead of number) - but changing that may be considered as a breaking change because treating the values depends on used JSS engine.