michael-s-molina commented on a change in pull request #17361:
URL: https://github.com/apache/superset/pull/17361#discussion_r750265296
##########
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:
@Damans227 @etr2460 Just to be sure here. The [superset-ui documentation
for
number-format](https://github.com/apache-superset/superset-ui/tree/master/packages/superset-ui-core/src/number-format)
referenced above states the following:
> It is powered by a registry to support registration of custom formatting,
with fallback to d3.format and handle error for invalid format string.
It's talking about the formatting string, which is the first parameter of
the function, and not about invalid formats for the `num` (second parameter).
Are you sure the value can be interpreted as strings?
--
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]