You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/01/22 22:23:09 UTC

[GitHub] [superset] ad-m commented on a change in pull request #18136: refactor: migrate DeleteComponentButton to TypeScript

ad-m commented on a change in pull request #18136:
URL: https://github.com/apache/superset/pull/18136#discussion_r790190680



##########
File path: superset-frontend/src/dashboard/components/DeleteComponentButton.tsx
##########
@@ -36,5 +33,5 @@ export default class DeleteComponentButton extends React.PureComponent {
   }
 }
 
-DeleteComponentButton.propTypes = propTypes;
-DeleteComponentButton.defaultProps = defaultProps;
+export default DeleteComponentButton;
+export { DeleteComponentButtonProps };

Review comment:
       Is there a need to export that? 

##########
File path: superset-frontend/src/dashboard/components/DeleteComponentButton.tsx
##########
@@ -16,18 +16,15 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-import React from 'react';
-import PropTypes from 'prop-types';
+import React, { MouseEventHandler } from 'react';
 import Icons from 'src/components/Icons';
 import IconButton from './IconButton';
 
-const propTypes = {
-  onDelete: PropTypes.func.isRequired,
+type DeleteComponentButtonProps = {
+  onDelete: MouseEventHandler<HTMLDivElement>;
 };
 
-const defaultProps = {};
-
-export default class DeleteComponentButton extends React.PureComponent {
+class DeleteComponentButton extends React.PureComponent<DeleteComponentButtonProps> {
   render() {
     const { onDelete } = this.props;

Review comment:
       > Can you add the default value for `onChange` please? I'm not sure if it's actually needed, but it won't hurt to keep it
   
   _Originally posted by @kgabryje in https://github.com/apache/superset/pull/18120#discussion_r789613146_
   
   Can you add the default value for `onDelete` please?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org