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/15 02:02:28 UTC

[GitHub] [superset] Damans227 commented on a change in pull request #17908: chore: migrate ErrorBoundary component from jsx to tsx

Damans227 commented on a change in pull request #17908:
URL: https://github.com/apache/superset/pull/17908#discussion_r785255038



##########
File path: superset-frontend/src/components/ErrorMessage/ErrorAlert.tsx
##########
@@ -82,7 +82,7 @@ const LeftSideContent = styled.div`
 
 interface ErrorAlertProps {
   body: ReactNode;
-  copyText?: string;
+  copyText?: string | JSX.Element;

Review comment:
       Type for `copyText` becomes invalid if `JSX.Element` type is not set. Following error gets thrown in the `ErrorMessageWithStackComponent`:
   
   ```
   (JSX attribute) copyText?: string | undefined
   Type 'Element' is not assignable to type 'string'.ts(2322)
   ErrorMessageWithStackTrace.tsx(33, 3): The expected type comes from property 'copyText' which is declared here on type 'IntrinsicAttributes & Props' 
   ```

##########
File path: superset-frontend/src/components/ErrorMessage/ErrorAlert.tsx
##########
@@ -82,7 +82,7 @@ const LeftSideContent = styled.div`
 
 interface ErrorAlertProps {
   body: ReactNode;
-  copyText?: string;
+  copyText?: string | JSX.Element;

Review comment:
       Yes, the typescript infers `const message` on line 52 as a JSX.Element. 
   
    
   ![Screen Shot 2022-01-14 at 8 54 54 PM](https://user-images.githubusercontent.com/61474540/149604673-de19aada-744f-47b5-9a54-9522e2c1cb00.png)
    

##########
File path: superset-frontend/src/components/ErrorMessage/ErrorMessageWithStackTrace.tsx
##########
@@ -30,8 +30,8 @@ type Props = {
   error?: SupersetError;
   link?: string;
   subtitle?: React.ReactNode;
-  copyText?: string;
-  stackTrace?: string;
+  copyText?: string | JSX.Element;

Review comment:
       Same reason as above




-- 
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