This is an automated email from the ASF dual-hosted git repository. maximebeauchemin pushed a commit to branch js-to-ts in repository https://gitbox.apache.org/repos/asf/superset.git
commit 291e07c345468775f8ede85b1be658054e2ccb48 Author: Maxime Beauchemin <[email protected]> AuthorDate: Sun Sep 7 14:35:58 2025 -0700 feat(typescript): migrate roundDecimal utility to TypeScript - Convert roundDecimal.js and test file from JavaScript to TypeScript - Add proper type annotations: (number: number, precision?: number): number - Refactor precision calculation to avoid TypeScript compilation issues - Maintain all existing functionality and test coverage - Use git mv to preserve file history 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> --- .../src/utils/{roundDecimal.js => roundDecimal.ts} | 11 +++++++---- .../test/utils/{roundDecimal.test.js => roundDecimal.test.ts} | 0 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/superset-frontend/plugins/legacy-plugin-chart-map-box/src/utils/roundDecimal.js b/superset-frontend/plugins/legacy-plugin-chart-map-box/src/utils/roundDecimal.ts similarity index 82% rename from superset-frontend/plugins/legacy-plugin-chart-map-box/src/utils/roundDecimal.js rename to superset-frontend/plugins/legacy-plugin-chart-map-box/src/utils/roundDecimal.ts index 50bb0e1f52..6c430c4074 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-map-box/src/utils/roundDecimal.js +++ b/superset-frontend/plugins/legacy-plugin-chart-map-box/src/utils/roundDecimal.ts @@ -17,11 +17,14 @@ * under the License. */ -export default function roundDecimal(number, precision) { - let roundedNumber; - let p = precision; +export default function roundDecimal( + number: number, + precision?: number, +): number { + let roundedNumber: number; if (precision) { - roundedNumber = Math.round(number * (p = 10 ** p)) / p; + const p = 10 ** precision; + roundedNumber = Math.round(number * p) / p; } else { roundedNumber = Math.round(number); } diff --git a/superset-frontend/plugins/legacy-plugin-chart-map-box/test/utils/roundDecimal.test.js b/superset-frontend/plugins/legacy-plugin-chart-map-box/test/utils/roundDecimal.test.ts similarity index 100% rename from superset-frontend/plugins/legacy-plugin-chart-map-box/test/utils/roundDecimal.test.js rename to superset-frontend/plugins/legacy-plugin-chart-map-box/test/utils/roundDecimal.test.ts
