etr2460 commented on a change in pull request #17361:
URL: https://github.com/apache/superset/pull/17361#discussion_r749473539



##########
File path: superset-frontend/src/visualizations/TimeTable/FormattedNumber.tsx
##########
@@ -17,27 +17,23 @@
  * under the License.
  */
 import React from 'react';
-import PropTypes from 'prop-types';
 import { formatNumber } from '@superset-ui/core';
 
-const propTypes = {
-  num: PropTypes.number,
-  format: PropTypes.string,
-};
-
-const defaultProps = {
-  num: 0,
-  format: undefined,
-};
+interface FormattedNumberProps {
+  num?: string | number;
+  format?: string;
+}
 
-function FormattedNumber({ num, format }) {
+function FormattedNumber({
+  num = 0,
+  format = undefined,
+}: FormattedNumberProps) {
   if (format) {
-    return <span title={num}>{formatNumber(format, num)}</span>;
+    return (
+      <span title={num as string}>{formatNumber(format, num as number)}</span>

Review comment:
       thanks for looking into this. Since `formatNumber(format, num)` has been 
working today already, and i'm a bit hesitant to `parseInt` the string in case 
we lose accuracy for very large numbers, I think it's ok to override typescript 
here. Once change I might make though is insead of doing `num as number` (which 
would imply that it's always a number, even when it isn't) I would add a `// 
@ts-expect-error formatNumber can actually accept strings, even though it's not 
typed as such` comment to bypass the TS error




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to