You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2025/06/03 00:13:57 UTC
(superset) 07/07: big migration
This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin pushed a commit to branch ts-migrate
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 297515db623695e404e8b3c3fb293b8877d28c66
Author: Maxime Beauchemin <ma...@gmail.com>
AuthorDate: Mon Jun 2 17:13:25 2025 -0700
big migration
---
.../superset-ui-chart-controls/src/types.ts | 2 +
.../operators/utils/extractExtraMetrics.test.ts | 2 +-
.../test/utils/defineSavedMetrics.test.tsx | 2 +-
.../test/utils/getColorFormatters.test.ts | 2 +-
.../src/components/AsyncEsmComponent/index.tsx | 2 +-
...hange.test.jsx => ConfirmStatusChange.test.tsx} | 0
.../components/CronPicker/CronPicker.stories.tsx | 2 +-
.../src/components/Dropdown/Dropdown.test.tsx | 2 +-
...ut.test.jsx => LabeledErrorBoundInput.test.tsx} | 6 +
.../{IconTooltip.test.jsx => IconTooltip.test.tsx} | 0
.../src/components/Label/Label.test.tsx | 1 -
.../src/components/Select/AsyncSelect.tsx | 6 +-
.../src/components/Select/Select.tsx | 2 +-
.../src/components/Skeleton/Skeleton.stories.tsx | 1 +
.../src/components/Table/sorters.test.ts | 26 +-
.../src/components/Table/utils/utils.test.ts | 8 +-
.../TableCollection/TableCollection.test.tsx | 2 +-
.../src/components/TelemetryPixel/index.tsx | 1 -
.../src/components/TimezoneSelector/index.tsx | 2 +-
.../superset-ui-core/src/math-expression/index.ts | 2 +-
.../src/models/ExtensibleFunction.ts | 2 +-
.../superset-ui-core/src/query/normalizeOrderBy.ts | 2 +-
.../src/query/processExtraFormData.ts | 2 +-
.../superset-ui-core/src/theme/utils.test.ts | 10 +-
.../test/chart/components/SuperChartCore.test.tsx | 2 +-
.../test/chart/components/reactify.test.tsx | 2 +-
.../test/connection/SupersetClientClass.test.ts | 6 +-
.../test/connection/callApi/callApi.test.ts | 2 +-
.../test/currency-format/CurrencyFormatter.test.ts | 10 +-
.../test/dimension/getBBoxDummyFill.ts | 6 +-
.../test/dimension/mergeMargin.test.ts | 2 +-
.../test/models/ExtensibleFunction.test.ts | 4 +-
.../test/number-format/NumberFormatter.test.ts | 4 +-
.../number-format/NumberFormatterRegistry.test.ts | 2 +-
.../factories/createD3NumberFormatter.test.ts | 2 +-
.../test/query/api/v1/makeApi.test.ts | 2 +-
.../test/query/buildQueryObject.test.ts | 2 +-
.../test/query/getClientErrorObject.test.ts | 8 +-
.../test/query/normalizeOrderBy.test.ts | 2 +-
.../test/query/processExtraFormData.test.ts | 2 +-
.../test/time-format/TimeFormatter.test.ts | 4 +-
.../test/time-format/TimeFormatterRegistry.test.ts | 2 +-
.../factories/createD3TimeFormatter.test.ts | 4 +-
.../test/utils/getSelectedText.test.ts | 2 +-
.../superset-ui-core/test/utils/lruCache.test.ts | 4 +-
.../src/{Calendar.js => Calendar.ts} | 8 +-
.../src/{ReactCalendar.jsx => ReactCalendar.tsx} | 2 +-
.../src/{index.js => index.ts} | 0
.../src/{transformProps.js => transformProps.ts} | 5 +-
.../src/vendor/{cal-heatmap.js => cal-heatmap.ts} | 418 ++++++------
.../src/{Chord.js => Chord.ts} | 33 +-
.../src/{ReactChord.jsx => ReactChord.tsx} | 2 +-
.../src/{index.js => index.ts} | 0
.../src/{transformProps.js => transformProps.ts} | 2 +-
.../src/{CountryMap.js => CountryMap.ts} | 31 +-
.../{ReactCountryMap.jsx => ReactCountryMap.tsx} | 2 +-
.../src/{index.js => index.ts} | 0
.../src/{transformProps.js => transformProps.ts} | 2 +-
.../src/{HorizonChart.jsx => HorizonChart.tsx} | 20 +-
.../src/{HorizonRow.jsx => HorizonRow.tsx} | 22 +-
.../src/{index.js => index.ts} | 0
.../src/{transformProps.js => transformProps.ts} | 2 +-
.../src/{MapBox.jsx => MapBox.tsx} | 24 +-
...tGlowOverlay.jsx => ScatterPlotGlowOverlay.tsx} | 38 +-
.../src/{index.js => index.ts} | 2 +
.../src/{transformProps.js => transformProps.ts} | 12 +-
.../src/utils/{geo.js => geo.ts} | 6 +-
.../{luminanceFromRGB.js => luminanceFromRGB.ts} | 6 +-
.../src/utils/{roundDecimal.js => roundDecimal.ts} | 2 +-
.../{roundDecimal.test.js => roundDecimal.test.ts} | 1 +
.../src/{PairedTTest.jsx => PairedTTest.tsx} | 6 +-
.../src/{TTestTable.jsx => TTestTable.tsx} | 40 +-
.../src/{index.js => index.ts} | 0
.../src/{transformProps.js => transformProps.ts} | 4 +-
...rallelCoordinates.js => ParallelCoordinates.ts} | 23 +-
...oordinates.jsx => ReactParallelCoordinates.tsx} | 2 +-
.../src/{index.js => index.ts} | 0
.../src/{transformProps.js => transformProps.ts} | 4 +-
.../parcoords/{d3.parcoords.js => d3.parcoords.ts} | 715 +++++++++++++++++----
.../vendor/parcoords/{divgrid.js => divgrid.ts} | 23 +-
.../src/{Partition.js => Partition.ts} | 68 +-
.../src/{ReactPartition.jsx => ReactPartition.tsx} | 2 +-
.../src/{index.js => index.ts} | 0
.../src/{transformProps.js => transformProps.ts} | 4 +-
...ription.test.jsx => OptionDescription.test.tsx} | 1 +
.../src/{ReactRose.jsx => ReactRose.tsx} | 2 +-
.../src/{Rose.js => Rose.ts} | 169 +++--
.../src/{index.js => index.ts} | 0
.../src/{transformProps.js => transformProps.ts} | 2 +-
.../src/{ReactWorldMap.jsx => ReactWorldMap.tsx} | 2 +-
.../src/{WorldMap.js => WorldMap.ts} | 41 +-
.../src/{index.js => index.ts} | 0
.../src/{transformProps.js => transformProps.ts} | 2 +-
.../legacy-preset-chart-deckgl/src/Multi/Multi.tsx | 2 +-
.../src/layers/Grid/Grid.tsx | 4 +-
.../src/layers/Hex/Hex.tsx | 4 +-
.../{Shared_DeckGL.jsx => Shared_DeckGL.tsx} | 12 +-
.../src/Bubble/{index.js => index.ts} | 0
.../src/Bullet/{index.js => index.ts} | 0
.../src/Compare/{index.js => index.ts} | 0
.../src/{NVD3Vis.js => NVD3Vis.ts} | 132 ++--
.../src/{PropTypes.js => PropTypes.ts} | 0
.../src/{ReactNVD3.jsx => ReactNVD3.tsx} | 4 +-
.../src/TimePivot/{index.js => index.ts} | 0
.../src/{index.js => index.ts} | 0
.../src/{preset.js => preset.ts} | 0
.../src/{transformProps.js => transformProps.ts} | 12 +-
.../src/{utils.js => utils.ts} | 104 +--
.../src/utils/{isTruthy.js => isTruthy.ts} | 2 +-
.../{AnnotationTypes.js => AnnotationTypes.ts} | 9 +-
.../superset/{exploreUtils.js => exploreUtils.ts} | 8 +-
.../test/{utils.test.js => utils.test.ts} | 2 +
.../utils/{isTruthy.test.js => isTruthy.test.ts} | 0
.../utils/{tokenize.test.js => tokenize.test.ts} | 0
.../src/util/layerUtil.tsx | 1 -
.../test/util/layerUtil.test.ts | 4 +-
.../src/BigNumber/BigNumberViz.tsx | 2 +-
.../BigNumberWithTrendline/transformProps.ts | 4 +-
.../src/BoxPlot/transformProps.ts | 4 +-
.../plugin-chart-echarts/src/BoxPlot/types.ts | 2 +-
.../src/Funnel/transformProps.ts | 1 -
.../plugin-chart-echarts/src/Funnel/types.ts | 2 +-
.../src/Gauge/transformProps.ts | 1 -
.../plugin-chart-echarts/src/Graph/types.ts | 2 +-
.../src/MixedTimeseries/EchartsMixedTimeseries.tsx | 1 -
.../src/MixedTimeseries/index.ts | 1 -
.../src/MixedTimeseries/transformProps.ts | 1 -
.../src/MixedTimeseries/types.ts | 2 +-
.../plugins/plugin-chart-echarts/src/Pie/types.ts | 2 +-
.../plugin-chart-echarts/src/Radar/types.ts | 2 +-
.../src/Timeseries/EchartsTimeseries.tsx | 2 +-
.../src/Timeseries/constants.ts | 2 +-
.../src/Timeseries/transformers.ts | 10 +-
.../test/BigNumber/transformProps.test.ts | 6 +-
.../src/PivotTableChart.tsx | 1 +
.../{PivotTable.jsx => PivotTable.tsx} | 2 +
.../src/react-pivottable/{Styles.js => Styles.ts} | 1 +
.../{TableRenderers.jsx => TableRenderers.tsx} | 180 ++++--
.../src/react-pivottable/{index.js => index.ts} | 0
.../{utilities.js => utilities.ts} | 196 ++++--
.../test/sortAlphanumericCaseInsensitive.test.ts | 2 +-
.../{mockExportObject.js => mockExportObject.ts} | 0
.../{mockExportString.js => mockExportString.ts} | 0
.../{mockChartQueries.js => mockChartQueries.ts} | 0
.../{mockDashboardData.js => mockDashboardData.ts} | 0
...DashboardFilters.js => mockDashboardFilters.ts} | 0
.../{mockDashboardInfo.js => mockDashboardInfo.ts} | 0
...ckDashboardLayout.js => mockDashboardLayout.ts} | 15 +
...mockDashboardState.js => mockDashboardState.ts} | 0
.../{mockDatasource.js => mockDatasource.ts} | 0
.../{mockReportState.js => mockReportState.ts} | 0
.../{mockSliceEntities.js => mockSliceEntities.ts} | 0
.../spec/fixtures/{mockState.js => mockState.ts} | 0
.../spec/fixtures/{mockStore.js => mockStore.ts} | 5 +-
...tupSupersetClient.js => setupSupersetClient.ts} | 0
superset-frontend/spec/helpers/shim.tsx | 2 +-
.../actions/{sqlLab.test.js => sqlLab.test.ts} | 78 ++-
.../src/SqlLab/actions/{sqlLab.js => sqlLab.ts} | 356 ++++++----
.../components/ExploreCtasResultsButton/index.tsx | 1 +
.../QueryAutoRefresh/QueryAutoRefresh.test.tsx | 23 +-
.../src/SqlLab/components/QueryTable/index.tsx | 1 +
.../SqlLab/components/ResultSet/ResultSet.test.tsx | 1 -
.../SaveDatasetModal/SaveDatasetModal.test.tsx | 6 +-
.../SqlLab/components/SaveDatasetModal/index.tsx | 2 +-
.../src/SqlLab/components/SqlEditor/index.tsx | 2 +
.../SqlLab/components/SqlEditorLeftBar/index.tsx | 1 +
.../SqlLab/components/TabbedSqlEditors/index.tsx | 1 +
.../src/SqlLab/components/TablePreview/index.tsx | 2 +-
...teEnhancer.js => persistSqlLabStateEnhancer.ts} | 18 +-
.../reducers/{sqlLab.test.js => sqlLab.test.ts} | 31 +-
.../src/SqlLab/reducers/{sqlLab.js => sqlLab.ts} | 144 ++++-
...dSliceTag.test.jsx => AlteredSliceTag.test.tsx} | 22 +-
superset-frontend/src/components/Chart/Chart.tsx | 1 +
.../{ChartContainer.jsx => ChartContainer.tsx} | 4 +-
.../Chart/ChartContextMenu/useContextMenu.test.tsx | 2 +-
...artRenderer.test.jsx => ChartRenderer.test.tsx} | 5 +-
.../Chart/{ChartRenderer.jsx => ChartRenderer.tsx} | 79 ++-
.../components/Chart/DrillBy/DrillByModal.test.tsx | 1 -
.../Chart/{chartAction.js => chartAction.ts} | 186 ++++--
.../{chartActions.test.js => chartActions.test.ts} | 34 +-
...chartReducers.test.js => chartReducers.test.ts} | 2 +-
...dal.test.jsx => ChangeDatasourceModal.test.tsx} | 0
...ceEditor.test.jsx => DatasourceEditor.test.tsx} | 4 +-
.../{DatasourceEditor.jsx => DatasourceEditor.tsx} | 266 ++++++--
....test.jsx => DatasourceEditorCurrency.test.tsx} | 8 +-
...orRTL.test.jsx => DatasourceEditorRTL.test.tsx} | 4 +
...urceModal.test.jsx => DatasourceModal.test.tsx} | 4 +-
.../components/Datasource/{utils.js => utils.ts} | 41 +-
.../ErrorMessage/OAuth2RedirectMessage.tsx | 1 +
.../{Toast.test.jsx => Toast.test.tsx} | 5 +-
...tPresenter.test.jsx => ToastPresenter.test.tsx} | 4 +-
.../{mockMessageToasts.js => mockMessageToasts.ts} | 0
.../{reducers.test.js => reducers.test.ts} | 1 +
.../MessageToasts/{reducers.js => reducers.ts} | 4 +-
.../{dashboardFilters.js => dashboardFilters.ts} | 22 +-
...boardLayout.test.js => dashboardLayout.test.ts} | 25 +-
.../{dashboardLayout.js => dashboardLayout.ts} | 60 +-
...shboardState.test.js => dashboardState.test.ts} | 19 +-
.../{dashboardState.js => dashboardState.ts} | 490 +++++++-------
.../dashboard/actions/{hydrate.js => hydrate.ts} | 20 +-
.../{Dashboard.test.jsx => Dashboard.test.tsx} | 32 +
.../components/{Dashboard.jsx => Dashboard.tsx} | 53 +-
.../DashboardBuilder/DashboardBuilder.tsx | 3 +-
...shboardGrid.test.jsx => DashboardGrid.test.tsx} | 6 +-
.../{DashboardGrid.jsx => DashboardGrid.tsx} | 49 +-
.../components/Header/{index.jsx => index.tsx} | 57 +-
.../{MissingChart.jsx => MissingChart.tsx} | 2 +-
.../src/dashboard/components/SliceAdder.tsx | 5 +-
.../components/SliceHeader/SliceHeader.test.tsx | 32 -
.../SliceHeaderControls.test.tsx | 14 +-
.../components/SliceHeaderControls/index.tsx | 1 -
...agDroppable.test.jsx => DragDroppable.test.tsx} | 21 +-
.../dnd/{DragDroppable.jsx => DragDroppable.tsx} | 39 +-
...agDroppableConfig.js => dragDroppableConfig.ts} | 14 +-
.../dnd/{handleDrop.js => handleDrop.ts} | 9 +-
.../dnd/{handleHover.js => handleHover.ts} | 3 +-
.../{FilterFieldItem.jsx => FilterFieldItem.tsx} | 2 +-
.../{FilterFieldTree.jsx => FilterFieldTree.tsx} | 2 +-
.../components/filterscope/FilterScope.test.tsx | 3 +
...erScopeSelector.jsx => FilterScopeSelector.tsx} | 56 +-
.../{FilterScopeTree.jsx => FilterScopeTree.tsx} | 2 +-
...reeNodes.jsx => renderFilterFieldTreeNodes.tsx} | 10 +-
...reeNodes.jsx => renderFilterScopeTreeNodes.tsx} | 13 +-
.../filterscope/{treeIcons.jsx => treeIcons.tsx} | 0
.../{Chart.test.jsx => Chart.test.tsx} | 10 +-
.../gridComponents/{Chart.jsx => Chart.tsx} | 37 +-
.../components/gridComponents/ChartHolder.test.tsx | 3 +
.../components/gridComponents/ChartHolder.tsx | 1 +
.../{Column.test.jsx => Column.test.tsx} | 21 +-
.../gridComponents/{Column.jsx => Column.tsx} | 19 +-
.../{Divider.test.jsx => Divider.test.tsx} | 10 +-
.../gridComponents/{Divider.jsx => Divider.tsx} | 13 +-
.../components/gridComponents/DynamicComponent.tsx | 5 +-
.../{Header.test.jsx => Header.test.tsx} | 10 +-
.../gridComponents/{Header.jsx => Header.tsx} | 30 +-
.../{Markdown.test.jsx => Markdown.test.tsx} | 5 +
.../gridComponents/{Markdown.jsx => Markdown.tsx} | 62 +-
.../gridComponents/{Row.test.jsx => Row.test.tsx} | 22 +-
.../components/gridComponents/{Row.jsx => Row.tsx} | 26 +-
.../components/gridComponents/{Tab.jsx => Tab.tsx} | 77 ++-
.../gridComponents/{Tabs.jsx => Tabs.tsx} | 22 +-
.../gridComponents/{index.js => index.ts} | 1 +
...ent.test.jsx => DraggableNewComponent.test.tsx} | 3 +-
.../gridComponents/new/DraggableNewComponent.tsx | 3 +-
.../new/{NewColumn.test.jsx => NewColumn.test.tsx} | 2 +-
.../new/{NewColumn.jsx => NewColumn.tsx} | 0
.../{NewDivider.test.jsx => NewDivider.test.tsx} | 2 +-
.../new/{NewDivider.jsx => NewDivider.tsx} | 0
.../new/{NewHeader.test.jsx => NewHeader.test.tsx} | 2 +-
.../new/{NewHeader.jsx => NewHeader.tsx} | 0
.../new/{NewMarkdown.jsx => NewMarkdown.tsx} | 0
.../new/{NewRow.test.jsx => NewRow.test.tsx} | 2 +-
.../gridComponents/new/{NewRow.jsx => NewRow.tsx} | 0
.../new/{NewTabs.test.jsx => NewTabs.test.tsx} | 2 +-
.../new/{NewTabs.jsx => NewTabs.tsx} | 0
.../menu/ShareMenuItems/ShareMenuItems.test.tsx | 2 +-
...poverMenu.test.jsx => WithPopoverMenu.test.tsx} | 8 +-
.../components/nativeFilters/FilterBar/state.ts | 2 +-
.../nativeFilters/FilterCard/FilterCard.test.tsx | 1 -
.../FiltersConfigForm/FilterScope/utils.test.ts | 46 +-
.../FiltersConfigForm/FiltersConfigForm.tsx | 8 +-
.../FiltersConfigForm/getControlItemsMap.test.tsx | 5 +-
.../FiltersConfigModal/NativeFiltersModal.test.tsx | 1 -
.../dashboard/components/nativeFilters/utils.ts | 3 +-
.../components/resizable/ResizableContainer.tsx | 4 +-
...shboardComponent.jsx => DashboardComponent.tsx} | 7 +-
.../{DashboardGrid.jsx => DashboardGrid.tsx} | 4 +-
.../{FilterScope.jsx => FilterScope.tsx} | 4 +-
.../containers/{SliceAdder.jsx => SliceAdder.tsx} | 7 +-
...yDashboardLayout.js => emptyDashboardLayout.ts} | 0
...ardFilters.test.js => dashboardFilters.test.ts} | 1 +
.../{dashboardFilters.js => dashboardFilters.ts} | 14 +-
.../{dashboardInfo.js => dashboardInfo.ts} | 3 +-
...boardLayout.test.js => dashboardLayout.test.ts} | 10 +-
.../{dashboardLayout.js => dashboardLayout.ts} | 37 +-
.../src/dashboard/reducers/dashboardState.test.ts | 6 +
.../{dashboardState.js => dashboardState.ts} | 12 +-
...sliceEntities.test.js => sliceEntities.test.ts} | 4 +
.../{sliceEntities.js => sliceEntities.ts} | 3 +-
...shboardLayout.js => undoableDashboardLayout.ts} | 0
...shboardFilters.js => activeDashboardFilters.ts} | 27 +-
...peTreeEntry.js => buildFilterScopeTreeEntry.ts} | 8 +-
.../src/dashboard/util/crossFilters.test.ts | 3 +-
.../{dnd-reorder.test.js => dnd-reorder.test.ts} | 0
.../util/{dnd-reorder.js => dnd-reorder.ts} | 8 +-
...sParent.test.js => dropOverflowsParent.test.ts} | 0
...opOverflowsParent.js => dropOverflowsParent.ts} | 5 +-
.../src/dashboard/util/extractUrlParams.test.ts | 4 +-
...er.test.js => findFirstParentContainer.test.ts} | 1 +
...entContainer.js => findFirstParentContainer.ts} | 5 +
.../src/dashboard/util/findParentId.test.ts | 8 +-
...=> getChartAndLabelComponentIdFromPath.test.ts} | 0
...h.js => getChartAndLabelComponentIdFromPath.ts} | 9 +-
...ayout.test.js => getChartIdsFromLayout.test.ts} | 3 +
...rtIdsFromLayout.js => getChartIdsFromLayout.ts} | 6 +-
...dthFromDrop.js => getComponentWidthFromDrop.ts} | 9 +-
...ashboardUrl.test.js => getDashboardUrl.test.ts} | 8 +
...h.test.js => getDetailedComponentWidth.test.ts} | 0
...ponentWidth.js => getDetailedComponentWidth.ts} | 17 +-
...athToTabIndex.js => getDirectPathToTabIndex.ts} | 5 +-
...ropPosition.test.js => getDropPosition.test.ts} | 25 +-
.../{getDropPosition.js => getDropPosition.ts} | 7 +-
...rs.test.js => getEffectiveExtraFilters.test.ts} | 2 +
.../util/{getEmptyLayout.js => getEmptyLayout.ts} | 0
...est.js => getFilterConfigsFromFormdata.test.ts} | 0
...Formdata.js => getFilterConfigsFromFormdata.ts} | 10 +-
...ieldNodesTree.js => getFilterFieldNodesTree.ts} | 1 +
...test.js => getFilterScopeFromNodesTree.test.ts} | 2 +-
...NodesTree.js => getFilterScopeFromNodesTree.ts} | 39 +-
...copeNodesTree.js => getFilterScopeNodesTree.ts} | 8 +-
...ParentNodes.js => getFilterScopeParentNodes.ts} | 8 +-
...terScopeTree.js => getKeyForFilterScopeTree.ts} | 2 +-
...ChartId.js => getLayoutComponentFromChartId.ts} | 8 +-
....test.js => getLeafComponentIdFromPath.test.ts} | 2 +
...IdFromPath.js => getLeafComponentIdFromPath.ts} | 2 +
....js => getSelectedChartIdForFilterScopeTree.ts} | 4 +-
...isDashboardLoading.js => isDashboardLoading.ts} | 3 +-
...ilterScopes.js => isInDifferentFilterScopes.ts} | 0
...childChartsDidLoad.js => childChartsDidLoad.ts} | 8 +-
...ChildChartIds.js => findNonTabChildChartIds.ts} | 19 +-
...ComponentIds.js => findTopLevelComponentIds.ts} | 14 +-
...nent.js => getLoadStatsPerTopLevelComponent.ts} | 5 +-
...Factory.test.js => newComponentFactory.test.ts} | 1 +
...wComponentFactory.js => newComponentFactory.ts} | 9 +-
...romDrop.test.js => newEntitiesFromDrop.test.ts} | 0
...wEntitiesFromDrop.js => newEntitiesFromDrop.ts} | 7 +-
.../util/{propShapes.jsx => propShapes.tsx} | 4 +-
...terValues.js => serializeActiveFilterValues.ts} | 4 +-
...izeFilterScopes.js => serializeFilterScopes.ts} | 3 +-
...ldWrapChildInRow.js => shouldWrapChildInRow.ts} | 6 +-
....test.js => updateComponentParentsList.test.ts} | 2 +
...arentsList.js => updateComponentParentsList.ts} | 4 +-
superset-frontend/src/dataMask/reducer.ts | 8 +-
.../src/explore/actions/datasourcesActions.test.ts | 2 +-
...ploreActions.test.js => exploreActions.test.ts} | 2 +
.../src/explore/actions/hydrateExplore.test.ts | 8 +-
.../CopyToClipboardButton.test.tsx | 4 +-
.../DataTablesPane/components/SamplesPane.tsx | 1 +
.../DataTablesPane/test/DataTablesPane.test.tsx | 2 +-
.../explore/components/DatasourcePanel/index.tsx | 2 +-
...eContent.test.jsx => EmbedCodeContent.test.tsx} | 0
.../{EmbedCodeContent.jsx => EmbedCodeContent.tsx} | 4 +-
.../ExploreChartHeader/ExploreChartHeader.test.tsx | 1 +
.../ExploreChartHeader/{index.jsx => index.tsx} | 17 +-
...rtPanel.test.jsx => ExploreChartPanel.test.tsx} | 0
.../ExploreChartPanel/{index.jsx => index.tsx} | 11 +-
.../ExploreViewContainer/{index.jsx => index.tsx} | 36 +-
.../{SaveModal.test.jsx => SaveModal.test.tsx} | 13 +-
.../src/explore/components/SaveModal.tsx | 2 +-
.../{AnnotationLayer.jsx => AnnotationLayer.tsx} | 189 ++++--
.../{AnnotationTypes.js => AnnotationTypes.ts} | 9 +-
...undsControl.test.jsx => BoundsControl.test.tsx} | 0
.../{CheckboxControl.jsx => CheckboxControl.tsx} | 5 +
.../CollectionControl/{index.jsx => index.tsx} | 33 +-
...lorPickerControl.jsx => ColorPickerControl.tsx} | 13 +-
.../ControlForm/ControlFormItem.tsx | 3 +-
.../ContourControl/ContourPopoverControl.tsx | 2 +
.../DatasourceControl/DatasourceControl.test.tsx | 6 +-
.../DatasourceControl/{index.jsx => index.tsx} | 48 +-
.../DndColumnSelectControl/ColumnSelectPopover.tsx | 4 +-
.../ColumnSelectPopoverTrigger.tsx | 2 +-
...erTitle.jsx => DndColumnSelectPopoverTitle.tsx} | 2 +-
.../DndColumnSelectControl/DndMetricSelect.tsx | 1 +
.../{AdhocFilter.test.js => AdhocFilter.test.ts} | 0
.../AdhocFilter/{index.js => index.ts} | 28 +-
.../AdhocFilterControl/{index.jsx => index.tsx} | 88 ++-
...er.test.jsx => AdhocFilterEditPopover.test.tsx} | 1 +
.../{index.jsx => index.tsx} | 53 +-
.../AdhocFilterEditPopoverSqlTabContent/index.tsx | 2 +-
.../AdhocFilterPopoverTrigger/index.tsx | 1 +
.../{adhocFilterType.js => adhocFilterType.ts} | 0
.../FilterControl/{columnType.js => columnType.ts} | 0
.../controls/FilterControl/utils/translateToSQL.ts | 7 +-
.../FixedOrMetricControl.test.tsx | 5 +
.../FixedOrMetricControl/{index.jsx => index.tsx} | 30 +-
.../{AdhocMetric.test.js => AdhocMetric.test.ts} | 3 +
.../{AdhocMetric.js => AdhocMetric.ts} | 27 +-
.../AdhocMetricEditPopover.test.tsx | 2 +
.../{index.jsx => index.tsx} | 96 ++-
...cOption.test.jsx => AdhocMetricOption.test.tsx} | 5 +-
...AdhocMetricOption.jsx => AdhocMetricOption.tsx} | 19 +-
.../MetricControl/AdhocMetricPopoverTrigger.tsx | 1 +
.../{AggregateOption.jsx => AggregateOption.tsx} | 4 +-
...on.test.jsx => FilterDefinitionOption.test.tsx} | 0
...nitionOption.jsx => FilterDefinitionOption.tsx} | 2 +-
...nitionOption.jsx => MetricDefinitionOption.tsx} | 2 +-
...lue.test.jsx => MetricDefinitionValue.test.tsx} | 3 +-
...finitionValue.jsx => MetricDefinitionValue.tsx} | 6 +-
...icsControl.test.jsx => MetricsControl.test.tsx} | 9 +-
.../{MetricsControl.jsx => MetricsControl.tsx} | 24 +-
.../{adhocMetricType.js => adhocMetricType.ts} | 0
...gregateOptionType.js => aggregateOptionType.ts} | 0
.../MetricControl/{columnType.js => columnType.ts} | 0
.../{savedMetricType.js => savedMetricType.ts} | 0
...lectControl.test.jsx => SelectControl.test.tsx} | 0
.../{SelectControl.jsx => SelectControl.tsx} | 60 +-
.../{SpatialControl.jsx => SpatialControl.tsx} | 37 +-
...eaControl.test.jsx => TextAreaControl.test.tsx} | 0
.../{TextAreaControl.jsx => TextAreaControl.tsx} | 37 +-
.../TimeSeriesColumnControl.test.tsx | 16 +
.../{index.jsx => index.tsx} | 71 +-
...rtControl.test.jsx => ViewportControl.test.tsx} | 0
.../{ViewportControl.jsx => ViewportControl.tsx} | 16 +-
.../components/controls/XAxisSortControl.tsx | 1 +
.../ZoomConfigControl/ZoomConfigControl.tsx | 8 +-
.../controls/ZoomConfigControl/zoomUtil.test.ts | 2 +-
.../components/controls/{index.js => index.ts} | 0
.../{index.jsx => index.tsx} | 23 +-
.../controlPanels/{Separator.js => Separator.ts} | 2 +-
...rides.js => timeGrainSqlaAnimationOverrides.ts} | 4 +-
.../src/explore/{controls.jsx => controls.tsx} | 47 +-
...exploreUtils.test.jsx => exploreUtils.test.tsx} | 18 +-
.../exploreUtils/getParsedExploreURLParams.test.ts | 2 +-
.../explore/exploreUtils/{index.js => index.ts} | 55 +-
...ploreReducer.test.js => exploreReducer.test.ts} | 0
.../{exploreReducer.js => exploreReducer.ts} | 50 +-
.../{saveModalReducer.js => saveModalReducer.ts} | 5 +-
.../src/explore/{store.test.jsx => store.test.tsx} | 4 +
.../src/explore/{store.js => store.ts} | 11 +-
.../src/features/alerts/AlertReportModal.test.tsx | 2 +-
.../src/features/alerts/AlertReportModal.tsx | 3 +-
...odal.test.jsx => AnnotationLayerModal.test.tsx} | 5 +-
...tionModal.test.jsx => AnnotationModal.test.tsx} | 5 +-
...ateModal.test.jsx => CssTemplateModal.test.tsx} | 5 +-
.../DatabaseModal/DatabaseConnectionForm/index.tsx | 3 +-
.../AddDataset/DatasetPanel/DatasetPanel.tsx | 1 -
.../AddDataset/EditDataset/UsageTab/index.tsx | 9 +-
...al.test.jsx => SavedQueryPreviewModal.test.tsx} | 5 +-
.../reports/ReportModal/{actions.js => actions.ts} | 40 +-
.../reports/ReportModal/{reducer.js => reducer.ts} | 11 +-
.../src/features/tags/BulkTagModal.tsx | 4 +-
superset-frontend/src/features/tags/TagModal.tsx | 6 +-
.../components/Range/RangeFilterPlugin.test.tsx | 3 +-
.../filters/components/Range/RangeFilterPlugin.tsx | 2 +-
.../src/filters/components/Range/buildQuery.ts | 2 +-
.../components/Select/SelectFilterPlugin.test.tsx | 8 +-
.../components/Select/SelectFilterPlugin.tsx | 2 +-
.../TimeColumn/TimeColumnFilterPlugin.tsx | 2 +-
.../components/TimeGrain/TimeGrainFilterPlugin.tsx | 2 +-
superset-frontend/src/filters/utils.ts | 1 -
.../middleware/{logger.test.js => logger.test.ts} | 8 +-
.../{loggerMiddleware.js => loggerMiddleware.ts} | 15 +-
...eportList.test.jsx => AlertReportList.test.tsx} | 0
...rList.test.jsx => AnnotationLayerList.test.tsx} | 0
...tationList.test.jsx => AnnotationList.test.tsx} | 5 +-
.../{ChartList.test.jsx => ChartList.test.tsx} | 10 +-
...plateList.test.jsx => CssTemplateList.test.tsx} | 0
...shboardList.test.jsx => DashboardList.test.tsx} | 6 +-
...DatabaseList.test.jsx => DatabaseList.test.tsx} | 1 +
superset-frontend/src/pages/Home/Home.test.tsx | 6 +-
.../QueryHistoryList/QueryHistoryList.test.tsx | 1 -
superset-frontend/src/setup/setupColors.ts | 2 -
superset-frontend/src/test.js | 2 -
superset-frontend/src/test.ts | 2 +
...cedMessageQueue.js => DebouncedMessageQueue.ts} | 10 +-
.../src/utils/{common.test.jsx => common.test.tsx} | 6 +-
.../src/utils/{common.js => common.ts} | 27 +-
.../{datasourceUtils.js => datasourceUtils.ts} | 2 +-
...zType.test.js => getControlsForVizType.test.ts} | 0
...trolsForVizType.js => getControlsForVizType.ts} | 10 +-
.../{hostNamesConfig.js => hostNamesConfig.ts} | 8 +-
.../src/utils/{reducerUtils.js => reducerUtils.ts} | 34 +-
superset-frontend/src/views/CRUD/utils.tsx | 1 -
superset-frontend/src/views/menu.tsx | 1 -
.../visualizations/TimeTable/FormattedNumber.tsx | 2 +-
.../TimeTable/{TimeTable.jsx => TimeTable.tsx} | 80 ++-
.../TimeTable/{controlPanel.js => controlPanel.ts} | 2 +-
.../presets/{MainPreset.js => MainPreset.ts} | 0
468 files changed, 5408 insertions(+), 2259 deletions(-)
diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/types.ts b/superset-frontend/packages/superset-ui-chart-controls/src/types.ts
index 3fbd234c1d..89e1aee0e5 100644
--- a/superset-frontend/packages/superset-ui-chart-controls/src/types.ts
+++ b/superset-frontend/packages/superset-ui-chart-controls/src/types.ts
@@ -371,7 +371,9 @@ export type CustomControlItem = {
export const isCustomControlItem = (obj: unknown): obj is CustomControlItem =>
typeof obj === 'object' &&
obj !== null &&
+ // @ts-expect-error TS(2339): Property 'name' does not exist on type 'object'.
typeof ('name' in obj && obj.name) === 'string' &&
+ // @ts-expect-error TS(2339): Property 'config' does not exist on type 'object'.
typeof ('config' in obj && obj.config) === 'object' &&
(obj as CustomControlItem).config !== null;
diff --git a/superset-frontend/packages/superset-ui-chart-controls/test/operators/utils/extractExtraMetrics.test.ts b/superset-frontend/packages/superset-ui-chart-controls/test/operators/utils/extractExtraMetrics.test.ts
index 116bfa7fd9..df3b6f9ded 100644
--- a/superset-frontend/packages/superset-ui-chart-controls/test/operators/utils/extractExtraMetrics.test.ts
+++ b/superset-frontend/packages/superset-ui-chart-controls/test/operators/utils/extractExtraMetrics.test.ts
@@ -129,7 +129,7 @@ test('returns empty array if timeseries_limit_metric is an empty array', () => {
expect(
extractExtraMetrics({
...baseFormData,
- // @ts-ignore
+ // @ts-expect-error TS(2322): Type 'never[]' is not assignable to type 'QueryFor... Remove this comment to see the full error message
timeseries_limit_metric: [],
}),
).toEqual([]);
diff --git a/superset-frontend/packages/superset-ui-chart-controls/test/utils/defineSavedMetrics.test.tsx b/superset-frontend/packages/superset-ui-chart-controls/test/utils/defineSavedMetrics.test.tsx
index f1c64ad4a7..7765d31d4f 100644
--- a/superset-frontend/packages/superset-ui-chart-controls/test/utils/defineSavedMetrics.test.tsx
+++ b/superset-frontend/packages/superset-ui-chart-controls/test/utils/defineSavedMetrics.test.tsx
@@ -51,7 +51,7 @@ describe('defineSavedMetrics', () => {
uuid: '1',
},
]);
- // @ts-ignore
+ // @ts-expect-error TS(2322): Type 'undefined' is not assignable to type 'Metric... Remove this comment to see the full error message
expect(defineSavedMetrics({ ...dataset, metrics: undefined })).toEqual([]);
});
diff --git a/superset-frontend/packages/superset-ui-chart-controls/test/utils/getColorFormatters.test.ts b/superset-frontend/packages/superset-ui-chart-controls/test/utils/getColorFormatters.test.ts
index 6551e815d7..6eba82bc92 100644
--- a/superset-frontend/packages/superset-ui-chart-controls/test/utils/getColorFormatters.test.ts
+++ b/superset-frontend/packages/superset-ui-chart-controls/test/utils/getColorFormatters.test.ts
@@ -284,7 +284,7 @@ describe('getColorFunction()', () => {
it('getColorFunction unsupported operator', () => {
const colorFunction = getColorFunction(
{
- // @ts-ignore
+ // @ts-expect-error TS(2322): Type '"unsupported operator"' is not assignable to... Remove this comment to see the full error message
operator: 'unsupported operator',
targetValue: 50,
colorScheme: '#FF0000',
diff --git a/superset-frontend/packages/superset-ui-core/src/components/AsyncEsmComponent/index.tsx b/superset-frontend/packages/superset-ui-core/src/components/AsyncEsmComponent/index.tsx
index dd643a8e1a..194c89545e 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/AsyncEsmComponent/index.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/AsyncEsmComponent/index.tsx
@@ -119,7 +119,7 @@ export function AsyncEsmComponent<
const Component = component || placeholder;
return Component ? (
// placeholder does not get the ref
- // @ts-ignore: Suppress TypeScript error for ref assignment
+ // @ts-expect-error TS(2322): Type '{ ref: RefObject<ComponentType<FullProps>> |... Remove this comment to see the full error message
<Component ref={Component === component ? ref : null} {...props} />
) : null;
});
diff --git a/superset-frontend/packages/superset-ui-core/src/components/ConfirmStatusChange/ConfirmStatusChange.test.jsx b/superset-frontend/packages/superset-ui-core/src/components/ConfirmStatusChange/ConfirmStatusChange.test.tsx
similarity index 100%
rename from superset-frontend/packages/superset-ui-core/src/components/ConfirmStatusChange/ConfirmStatusChange.test.jsx
rename to superset-frontend/packages/superset-ui-core/src/components/ConfirmStatusChange/ConfirmStatusChange.test.tsx
diff --git a/superset-frontend/packages/superset-ui-core/src/components/CronPicker/CronPicker.stories.tsx b/superset-frontend/packages/superset-ui-core/src/components/CronPicker/CronPicker.stories.tsx
index 1bc2748f93..4b79dbe021 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/CronPicker/CronPicker.stories.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/CronPicker/CronPicker.stories.tsx
@@ -28,7 +28,7 @@ export default {
};
export const InteractiveCronPicker = (props: CronProps) => {
- // @ts-ignore
+ // @ts-expect-error TS(2749): 'Input' refers to a value, but is being used as a ... Remove this comment to see the full error message
const inputRef = useRef<Input>(null);
const [value, setValue] = useState(props.value);
const customSetValue = useCallback(
diff --git a/superset-frontend/packages/superset-ui-core/src/components/Dropdown/Dropdown.test.tsx b/superset-frontend/packages/superset-ui-core/src/components/Dropdown/Dropdown.test.tsx
index 9baaef9adb..a42fec5a0e 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/Dropdown/Dropdown.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/Dropdown/Dropdown.test.tsx
@@ -26,7 +26,7 @@ const props = {
describe('NoAnimationDropdown', () => {
it('requires children', () => {
expect(() => {
- // @ts-ignore need to test the error case
+ // @ts-expect-error TS(2741): Property 'children' is missing in type '{ overlay:... Remove this comment to see the full error message
render(<NoAnimationDropdown {...props} />);
}).toThrow();
});
diff --git a/superset-frontend/packages/superset-ui-core/src/components/Form/LabeledErrorBoundInput.test.jsx b/superset-frontend/packages/superset-ui-core/src/components/Form/LabeledErrorBoundInput.test.tsx
similarity index 80%
rename from superset-frontend/packages/superset-ui-core/src/components/Form/LabeledErrorBoundInput.test.jsx
rename to superset-frontend/packages/superset-ui-core/src/components/Form/LabeledErrorBoundInput.test.tsx
index 2b66127e23..66fae197aa 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/Form/LabeledErrorBoundInput.test.jsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/Form/LabeledErrorBoundInput.test.tsx
@@ -35,6 +35,7 @@ const defaultProps = {
describe('LabeledErrorBoundInput', () => {
it('renders a LabeledErrorBoundInput normally, without an error', () => {
+ // @ts-expect-error TS(2322): Type '{ id: number; label: string; name: string; v... Remove this comment to see the full error message
render(<LabeledErrorBoundInput {...defaultProps} />);
const label = screen.getByText(/username/i);
@@ -49,6 +50,7 @@ describe('LabeledErrorBoundInput', () => {
it('renders a LabeledErrorBoundInput with an error', () => {
// Pass an error into props, causing errorText to replace helperText
defaultProps.errorMessage = 'Example error message';
+ // @ts-expect-error TS(2322): Type '{ id: number; label: string; name: string; v... Remove this comment to see the full error message
render(<LabeledErrorBoundInput {...defaultProps} />);
const label = screen.getByText(/username/i);
@@ -61,6 +63,7 @@ describe('LabeledErrorBoundInput', () => {
});
it('renders a LabeledErrorBoundInput with a InfoTooltip', async () => {
defaultProps.hasTooltip = true;
+ // @ts-expect-error TS(2322): Type '{ id: number; label: string; name: string; v... Remove this comment to see the full error message
render(<LabeledErrorBoundInput {...defaultProps} />);
const label = screen.getByText(/username/i);
@@ -76,7 +79,9 @@ describe('LabeledErrorBoundInput', () => {
});
it('becomes a password input if visibilityToggle prop is passed in', async () => {
+ // @ts-expect-error TS(2339): Property 'visibilityToggle' does not exist on type... Remove this comment to see the full error message
defaultProps.visibilityToggle = true;
+ // @ts-expect-error TS(2322): Type '{ id: number; label: string; name: string; v... Remove this comment to see the full error message
render(<LabeledErrorBoundInput {...defaultProps} />);
expect(await screen.findByTestId('icon-eye')).toBeVisible();
@@ -84,6 +89,7 @@ describe('LabeledErrorBoundInput', () => {
it('becomes a password input if props.name === password (backwards compatibility)', async () => {
defaultProps.name = 'password';
+ // @ts-expect-error TS(2322): Type '{ id: number; label: string; name: string; v... Remove this comment to see the full error message
render(<LabeledErrorBoundInput {...defaultProps} />);
expect(await screen.findByTestId('icon-eye')).toBeVisible();
diff --git a/superset-frontend/packages/superset-ui-core/src/components/IconTooltip/IconTooltip.test.jsx b/superset-frontend/packages/superset-ui-core/src/components/IconTooltip/IconTooltip.test.tsx
similarity index 100%
rename from superset-frontend/packages/superset-ui-core/src/components/IconTooltip/IconTooltip.test.jsx
rename to superset-frontend/packages/superset-ui-core/src/components/IconTooltip/IconTooltip.test.tsx
diff --git a/superset-frontend/packages/superset-ui-core/src/components/Label/Label.test.tsx b/superset-frontend/packages/superset-ui-core/src/components/Label/Label.test.tsx
index 1dff7c6e69..b4a09382f9 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/Label/Label.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/Label/Label.test.tsx
@@ -36,7 +36,6 @@ test('works with an onClick handler', () => {
// test stories from the storybook!
test('renders all the storybook gallery variants', () => {
- // @ts-ignore: Suppress TypeScript error for LabelGallery usage
const { container } = render(<LabelGallery />);
const nonInteractiveLabelCount = 4;
const renderedLabelCount = options.length * 2 + nonInteractiveLabelCount;
diff --git a/superset-frontend/packages/superset-ui-core/src/components/Select/AsyncSelect.tsx b/superset-frontend/packages/superset-ui-core/src/components/Select/AsyncSelect.tsx
index 9a91565734..fc8c4f195a 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/Select/AsyncSelect.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/Select/AsyncSelect.tsx
@@ -479,10 +479,10 @@ const AsyncSelect = forwardRef(
fullSelectOptions.filter(opt => set.has(opt.value)),
);
if (isSingleMode) {
- // @ts-ignore
+ // @ts-expect-error TS(2345): Argument of type 'string | number | RawValue[] | L... Remove this comment to see the full error message
onChange?.(selectValue, options[0]);
} else {
- // @ts-ignore
+ // @ts-expect-error TS(2345): Argument of type '(string | number | LabeledValue)... Remove this comment to see the full error message
onChange?.(array, options);
}
}
@@ -612,7 +612,7 @@ const AsyncSelect = forwardRef(
onBlur={handleOnBlur}
onDeselect={handleOnDeselect}
onDropdownVisibleChange={handleOnDropdownVisibleChange}
- // @ts-ignore
+ // @ts-expect-error TS(2322): Type '{ ref: RefObject<AsyncSelectRef>; className?... Remove this comment to see the full error message
onPaste={onPaste}
onPopupScroll={handlePagination}
onSearch={showSearch ? handleOnSearch : undefined}
diff --git a/superset-frontend/packages/superset-ui-core/src/components/Select/Select.tsx b/superset-frontend/packages/superset-ui-core/src/components/Select/Select.tsx
index 38d254c582..bcc6d2bd7a 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/Select/Select.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/Select/Select.tsx
@@ -698,7 +698,7 @@ const Select = forwardRef(
onBlur={handleOnBlur}
onDeselect={handleOnDeselect}
onDropdownVisibleChange={handleOnDropdownVisibleChange}
- // @ts-ignore
+ // @ts-expect-error TS(2322): Type '{ showSearch: boolean; ref: Ref<BaseSelectRe... Remove this comment to see the full error message
onPaste={onPaste}
onPopupScroll={undefined}
onSearch={shouldShowSearch ? handleOnSearch : undefined}
diff --git a/superset-frontend/packages/superset-ui-core/src/components/Skeleton/Skeleton.stories.tsx b/superset-frontend/packages/superset-ui-core/src/components/Skeleton/Skeleton.stories.tsx
index cafbfdb1de..f7057186b4 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/Skeleton/Skeleton.stories.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/Skeleton/Skeleton.stories.tsx
@@ -138,6 +138,7 @@ export default {
typeof Skeleton & typeof Avatar & typeof Button & typeof Input & typeof Image
>;
+// @ts-expect-error TS(4081): Exported type alias 'Story' has or is using privat... Remove this comment to see the full error message
type Story = StoryObj<typeof Skeleton & typeof Button & typeof Avatar>;
export const SkeletonStory: Story = {
diff --git a/superset-frontend/packages/superset-ui-core/src/components/Table/sorters.test.ts b/superset-frontend/packages/superset-ui-core/src/components/Table/sorters.test.ts
index d4f506ac3e..74bb6884fd 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/Table/sorters.test.ts
+++ b/superset-frontend/packages/superset-ui-core/src/components/Table/sorters.test.ts
@@ -45,20 +45,20 @@ const rows = [
* 1 or greater means the first item comes before the second item
*/
test('alphabeticalSort sorts correctly', () => {
- // @ts-ignore
+ // @ts-expect-error TS(2345): Argument of type '{ name: string; category: string... Remove this comment to see the full error message
expect(alphabeticalSort('name', rows[0], rows[1])).toBe(-1);
- // @ts-ignore
+ // @ts-expect-error TS(2345): Argument of type '{ name: string; category: string... Remove this comment to see the full error message
expect(alphabeticalSort('name', rows[1], rows[0])).toBe(1);
- // @ts-ignore
+ // @ts-expect-error TS(2345): Argument of type '{ name: string; category: string... Remove this comment to see the full error message
expect(alphabeticalSort('category', rows[1], rows[0])).toBe(0);
});
test('numericalSort sorts correctly', () => {
- // @ts-ignore
+ // @ts-expect-error TS(2345): Argument of type '{ name: string; category: string... Remove this comment to see the full error message
expect(numericalSort('cost', rows[1], rows[2])).toBe(0);
- // @ts-ignore
+ // @ts-expect-error TS(2345): Argument of type '{ name: string; category: string... Remove this comment to see the full error message
expect(numericalSort('cost', rows[1], rows[0])).toBeLessThan(0);
- // @ts-ignore
+ // @ts-expect-error TS(2345): Argument of type '{ name: string; category: string... Remove this comment to see the full error message
expect(numericalSort('cost', rows[4], rows[1])).toBeGreaterThan(0);
});
@@ -68,10 +68,10 @@ test('numericalSort sorts correctly', () => {
* In the case the sorter cannot perform the comparison it should return undefined and the next sort step will proceed without error
*/
test('alphabeticalSort bad inputs no errors', () => {
- // @ts-ignore
+ // @ts-expect-error TS(2345): Argument of type 'null' is not assignable to param... Remove this comment to see the full error message
expect(alphabeticalSort('name', null, null)).toBe(undefined);
// incorrect non-object values
- // @ts-ignore
+ // @ts-expect-error TS(2345): Argument of type 'number' is not assignable to par... Remove this comment to see the full error message
expect(alphabeticalSort('name', 3, [])).toBe(undefined);
// incorrect object values without specified key
expect(alphabeticalSort('name', {}, {})).toBe(undefined);
@@ -79,7 +79,7 @@ test('alphabeticalSort bad inputs no errors', () => {
expect(
alphabeticalSort(
'name',
- // @ts-ignore
+ // @ts-expect-error TS(2322): Type '{ title: string; }' is not assignable to typ... Remove this comment to see the full error message
{ name: { title: 'the name attribute should not be an object' } },
{ name: 'Doug' },
),
@@ -87,12 +87,12 @@ test('alphabeticalSort bad inputs no errors', () => {
});
test('numericalSort bad inputs no errors', () => {
- // @ts-ignore
+ // @ts-expect-error TS(2345): Argument of type 'undefined' is not assignable to ... Remove this comment to see the full error message
expect(numericalSort('name', undefined, undefined)).toBe(NaN);
- // @ts-ignore
+ // @ts-expect-error TS(2345): Argument of type 'null' is not assignable to param... Remove this comment to see the full error message
expect(numericalSort('name', null, null)).toBe(NaN);
// incorrect non-object values
- // @ts-ignore
+ // @ts-expect-error TS(2345): Argument of type 'number' is not assignable to par... Remove this comment to see the full error message
expect(numericalSort('name', 3, [])).toBe(NaN);
// incorrect object values without specified key
expect(numericalSort('name', {}, {})).toBe(NaN);
@@ -100,7 +100,7 @@ test('numericalSort bad inputs no errors', () => {
expect(
numericalSort(
'name',
- // @ts-ignore
+ // @ts-expect-error TS(2322): Type '{ title: string; }' is not assignable to typ... Remove this comment to see the full error message
{ name: { title: 'the name attribute should not be an object' } },
{ name: 'Doug' },
),
diff --git a/superset-frontend/packages/superset-ui-core/src/components/Table/utils/utils.test.ts b/superset-frontend/packages/superset-ui-core/src/components/Table/utils/utils.test.ts
index fc60729dc9..97b8d042ba 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/Table/utils/utils.test.ts
+++ b/superset-frontend/packages/superset-ui-core/src/components/Table/utils/utils.test.ts
@@ -46,12 +46,12 @@ test('withinRange unsupported negative numbers', async () => {
test('withinRange invalid inputs', async () => {
// Invalid inputs should return falsy and not throw an error
// We need ts-ignore here to be able to pass invalid values and pass linting
- // @ts-ignore
+ // @ts-expect-error TS(2345): Argument of type 'null' is not assignable to param... Remove this comment to see the full error message
expect(withinRange(null, 60, undefined)).toBeFalsy();
- // @ts-ignore
+ // @ts-expect-error TS(2345): Argument of type 'never[]' is not assignable to pa... Remove this comment to see the full error message
expect(withinRange([], 'hello', {})).toBeFalsy();
- // @ts-ignore
+ // @ts-expect-error TS(2345): Argument of type 'never[]' is not assignable to pa... Remove this comment to see the full error message
expect(withinRange([], undefined, {})).toBeFalsy();
- // @ts-ignore
+ // @ts-expect-error TS(2345): Argument of type 'never[]' is not assignable to pa... Remove this comment to see the full error message
expect(withinRange([], 'hello', {})).toBeFalsy();
});
diff --git a/superset-frontend/packages/superset-ui-core/src/components/TableCollection/TableCollection.test.tsx b/superset-frontend/packages/superset-ui-core/src/components/TableCollection/TableCollection.test.tsx
index 52461fff66..d2157f298f 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/TableCollection/TableCollection.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/TableCollection/TableCollection.test.tsx
@@ -51,7 +51,7 @@ beforeEach(() => {
col2: 'Line 03 - Col 02',
},
];
- // @ts-ignore
+ // @ts-expect-error TS(2322): Type '{ Header: string; accessor: string; id: stri... Remove this comment to see the full error message
const tableHookResult = renderHook(() => useTable({ columns, data }));
tableHook = tableHookResult.result.current;
defaultProps = {
diff --git a/superset-frontend/packages/superset-ui-core/src/components/TelemetryPixel/index.tsx b/superset-frontend/packages/superset-ui-core/src/components/TelemetryPixel/index.tsx
index 9e7818a1b7..d4583cb9da 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/TelemetryPixel/index.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/TelemetryPixel/index.tsx
@@ -47,7 +47,6 @@ const TelemetryPixel = ({
const pixelPath = `https://apachesuperset.gateway.scarf.sh/pixel/${PIXEL_ID}/${version}/${sha}/${build}`;
return process.env.SCARF_ANALYTICS === 'false' ? null : (
<img
- // @ts-ignore
referrerPolicy="no-referrer-when-downgrade"
src={pixelPath}
width={0}
diff --git a/superset-frontend/packages/superset-ui-core/src/components/TimezoneSelector/index.tsx b/superset-frontend/packages/superset-ui-core/src/components/TimezoneSelector/index.tsx
index 3dd0ede01c..1235481579 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/TimezoneSelector/index.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/TimezoneSelector/index.tsx
@@ -76,7 +76,7 @@ export default function TimezoneSelector({
};
// TODO: remove this ts-ignore when typescript is upgraded to 5.1
- // @ts-ignore
+ // @ts-expect-error TS(2339): Property 'supportedValuesOf' does not exist on typ... Remove this comment to see the full error message
const ALL_ZONES: string[] = Intl.supportedValuesOf('timeZone');
const labels = new Set<string>();
diff --git a/superset-frontend/packages/superset-ui-core/src/math-expression/index.ts b/superset-frontend/packages/superset-ui-core/src/math-expression/index.ts
index bf5ac817cd..68270cb2d9 100644
--- a/superset-frontend/packages/superset-ui-core/src/math-expression/index.ts
+++ b/superset-frontend/packages/superset-ui-core/src/math-expression/index.ts
@@ -109,7 +109,7 @@ export function evalExpression(expression: string, value: number): number {
parsedExpression = subExpressions[1] ?? subExpressions[0];
// we can ignore the type requirement on `TOKENS`, as value is always `number`
// and doesn't need to consider `number | undefined`.
- // @ts-ignore
+ // @ts-expect-error TS(2345): Argument of type '({ type: number; token: string; ... Remove this comment to see the full error message
return Number(mexp.eval(parsedExpression, TOKENS, { x: value }));
}
diff --git a/superset-frontend/packages/superset-ui-core/src/models/ExtensibleFunction.ts b/superset-frontend/packages/superset-ui-core/src/models/ExtensibleFunction.ts
index 5a247d751e..2a66b72d35 100644
--- a/superset-frontend/packages/superset-ui-core/src/models/ExtensibleFunction.ts
+++ b/superset-frontend/packages/superset-ui-core/src/models/ExtensibleFunction.ts
@@ -22,7 +22,7 @@
*/
export default class ExtensibleFunction extends Function {
- // @ts-ignore
+ // @ts-expect-error TS(2377): Constructors for derived classes must contain a 's... Remove this comment to see the full error message
constructor(fn: Function) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, no-constructor-return
return Object.setPrototypeOf(fn, new.target.prototype);
diff --git a/superset-frontend/packages/superset-ui-core/src/query/normalizeOrderBy.ts b/superset-frontend/packages/superset-ui-core/src/query/normalizeOrderBy.ts
index 840cf4c1a1..8c76b8ba76 100644
--- a/superset-frontend/packages/superset-ui-core/src/query/normalizeOrderBy.ts
+++ b/superset-frontend/packages/superset-ui-core/src/query/normalizeOrderBy.ts
@@ -63,7 +63,7 @@ export default function normalizeOrderBy(
) {
return {
...cloneQueryObject,
- // @ts-ignore
+ // @ts-expect-error TS(2322): Type 'unknown' is not assignable to type 'string |... Remove this comment to see the full error message
orderby: [[queryObject.legacy_order_by, isAsc]],
};
}
diff --git a/superset-frontend/packages/superset-ui-core/src/query/processExtraFormData.ts b/superset-frontend/packages/superset-ui-core/src/query/processExtraFormData.ts
index 29eabe75e3..c609b9e45a 100644
--- a/superset-frontend/packages/superset-ui-core/src/query/processExtraFormData.ts
+++ b/superset-frontend/packages/superset-ui-core/src/query/processExtraFormData.ts
@@ -38,7 +38,7 @@ export function overrideExtraFormData(
);
EXTRA_FORM_DATA_OVERRIDE_EXTRA_KEYS.forEach(key => {
if (key in overrideFormData) {
- // @ts-ignore
+ // @ts-expect-error TS(2322): Type 'string | undefined' is not assignable to typ... Remove this comment to see the full error message
overriddenExtras[key] = overrideFormData[key];
}
});
diff --git a/superset-frontend/packages/superset-ui-core/src/theme/utils.test.ts b/superset-frontend/packages/superset-ui-core/src/theme/utils.test.ts
index 343f59794f..11dc029a05 100644
--- a/superset-frontend/packages/superset-ui-core/src/theme/utils.test.ts
+++ b/superset-frontend/packages/superset-ui-core/src/theme/utils.test.ts
@@ -80,7 +80,7 @@ describe('Theme utilities', () => {
it('returns false when algorithm is an array containing a function', () => {
const config: AnyThemeConfig = {
token: { colorPrimary: '#ff0000' },
- // @ts-ignore
+ // @ts-expect-error TS(2322): Type 'DerivativeFunc<SeedToken, MapToken>' is not ... Remove this comment to see the full error message
algorithm: [antdThemeImport.darkAlgorithm, 'compact'],
};
expect(isSerializableConfig(config)).toBe(false);
@@ -193,7 +193,7 @@ describe('Theme utilities', () => {
const unknownAlgorithm = () => ({});
const config: AntdThemeConfig = {
token: { colorPrimary: '#ff0000' },
- // @ts-ignore
+ // @ts-expect-error TS(2322): Type '() => {}' is not assignable to type 'Mapping... Remove this comment to see the full error message
algorithm: unknownAlgorithm,
};
const result = serializeThemeConfig(config);
@@ -222,7 +222,7 @@ describe('Theme utilities', () => {
const unknownAlgorithm = () => ({});
const config: AntdThemeConfig = {
token: { colorPrimary: '#ff0000' },
- // @ts-ignore
+ // @ts-expect-error TS(2322): Type '() => {}' is not assignable to type 'Mapping... Remove this comment to see the full error message
algorithm: [antdThemeImport.darkAlgorithm, unknownAlgorithm],
};
const result = serializeThemeConfig(config);
@@ -237,10 +237,10 @@ describe('Theme utilities', () => {
token: { colorPrimary: '#ff0000' },
algorithm: [
antdThemeImport.darkAlgorithm,
- // @ts-ignore
+ // @ts-expect-error TS(2322): Type '() => {}' is not assignable to type 'Mapping... Remove this comment to see the full error message
unknownAlgorithm1,
antdThemeImport.compactAlgorithm,
- // @ts-ignore
+ // @ts-expect-error TS(2322): Type '() => {}' is not assignable to type 'Mapping... Remove this comment to see the full error message
unknownAlgorithm2,
],
};
diff --git a/superset-frontend/packages/superset-ui-core/test/chart/components/SuperChartCore.test.tsx b/superset-frontend/packages/superset-ui-core/test/chart/components/SuperChartCore.test.tsx
index 9d6db54043..e790453f7e 100644
--- a/superset-frontend/packages/superset-ui-core/test/chart/components/SuperChartCore.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/test/chart/components/SuperChartCore.test.tsx
@@ -89,7 +89,7 @@ describe('SuperChartCore', () => {
});
it('does not render if chartType is not set', async () => {
- // @ts-ignore chartType is required
+ // @ts-expect-error TS(2769): No overload matches this call.
const { container } = renderWithTheme(<SuperChartCore />);
await waitFor(() => {
diff --git a/superset-frontend/packages/superset-ui-core/test/chart/components/reactify.test.tsx b/superset-frontend/packages/superset-ui-core/test/chart/components/reactify.test.tsx
index c2b7c43450..c99c0302c9 100644
--- a/superset-frontend/packages/superset-ui-core/test/chart/components/reactify.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/test/chart/components/reactify.test.tsx
@@ -129,7 +129,7 @@ describe('reactify(renderFn)', () => {
it('does not try to render if not mounted', () => {
const anotherRenderFn = jest.fn();
const AnotherChart = reactify(anotherRenderFn); // enables valid new AnotherChart() call
- // @ts-ignore
+ // @ts-expect-error TS(2339): Property 'execute' does not exist on type 'Compone... Remove this comment to see the full error message
new AnotherChart({ id: 'test' }).execute();
expect(anotherRenderFn).not.toHaveBeenCalled();
});
diff --git a/superset-frontend/packages/superset-ui-core/test/connection/SupersetClientClass.test.ts b/superset-frontend/packages/superset-ui-core/test/connection/SupersetClientClass.test.ts
index f7534e2c5c..afcd086cba 100644
--- a/superset-frontend/packages/superset-ui-core/test/connection/SupersetClientClass.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/connection/SupersetClientClass.test.ts
@@ -523,9 +523,9 @@ describe('SupersetClientClass', () => {
beforeEach(() => {
originalLocation = window.location;
- // @ts-ignore
+ // @ts-expect-error TS(2790): The operand of a 'delete' operator must be optiona... Remove this comment to see the full error message
delete window.location;
- // @ts-ignore
+ // @ts-expect-error TS(2322): Type '{ pathname: string; search: string; href: st... Remove this comment to see the full error message
window.location = {
pathname: mockRequestPath,
search: mockRequestSearch,
@@ -563,7 +563,7 @@ describe('SupersetClientClass', () => {
it('should not redirect again if already on login page', async () => {
const client = new SupersetClientClass({});
- // @ts-expect-error
+ // @ts-expect-error TS(2322): Type '{ href: string; pathname: string; search: st... Remove this comment to see the full error message
window.location = {
href: '/login?next=something',
pathname: '/login',
diff --git a/superset-frontend/packages/superset-ui-core/test/connection/callApi/callApi.test.ts b/superset-frontend/packages/superset-ui-core/test/connection/callApi/callApi.test.ts
index 387b96575b..41654b9a75 100644
--- a/superset-frontend/packages/superset-ui-core/test/connection/callApi/callApi.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/connection/callApi/callApi.test.ts
@@ -26,7 +26,7 @@ import { LOGIN_GLOB } from '../fixtures/constants';
// missing the toString function causing method to error out when casting to String
class BadObject {}
const corruptObject = new BadObject();
-/* @ts-expect-error */
+// @ts-expect-error TS(2322): Type 'undefined' is not assignable to type '() => ... Remove this comment to see the full error message
BadObject.prototype.toString = undefined;
const mockGetUrl = '/mock/get/url';
diff --git a/superset-frontend/packages/superset-ui-core/test/currency-format/CurrencyFormatter.test.ts b/superset-frontend/packages/superset-ui-core/test/currency-format/CurrencyFormatter.test.ts
index b731b1ba49..1c27901c2c 100644
--- a/superset-frontend/packages/superset-ui-core/test/currency-format/CurrencyFormatter.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/currency-format/CurrencyFormatter.test.ts
@@ -67,18 +67,18 @@ test('CurrencyFormatter:hasValidCurrency', () => {
expect(currencyFormatter.hasValidCurrency()).toBe(true);
const currencyFormatterWithoutPosition = new CurrencyFormatter({
- // @ts-ignore
+ // @ts-expect-error TS(2741): Property 'symbolPosition' is missing in type '{ sy... Remove this comment to see the full error message
currency: { symbol: 'USD' },
});
expect(currencyFormatterWithoutPosition.hasValidCurrency()).toBe(true);
const currencyFormatterWithoutSymbol = new CurrencyFormatter({
- // @ts-ignore
+ // @ts-expect-error TS(2741): Property 'symbol' is missing in type '{ symbolPosi... Remove this comment to see the full error message
currency: { symbolPosition: 'prefix' },
});
expect(currencyFormatterWithoutSymbol.hasValidCurrency()).toBe(false);
- // @ts-ignore
+ // @ts-expect-error TS(2345): Argument of type '{}' is not assignable to paramet... Remove this comment to see the full error message
const currencyFormatterWithoutCurrency = new CurrencyFormatter({});
expect(currencyFormatterWithoutCurrency.hasValidCurrency()).toBe(false);
});
@@ -129,12 +129,12 @@ test('CurrencyFormatter:format', () => {
expect(currencyFormatterWithSuffix(VALUE)).toEqual('56.1M $');
const currencyFormatterWithoutPosition = new CurrencyFormatter({
- // @ts-ignore
+ // @ts-expect-error TS(2741): Property 'symbolPosition' is missing in type '{ sy... Remove this comment to see the full error message
currency: { symbol: 'USD' },
});
expect(currencyFormatterWithoutPosition(VALUE)).toEqual('56.1M $');
- // @ts-ignore
+ // @ts-expect-error TS(2345): Argument of type '{}' is not assignable to paramet... Remove this comment to see the full error message
const currencyFormatterWithoutCurrency = new CurrencyFormatter({});
expect(currencyFormatterWithoutCurrency(VALUE)).toEqual('56.1M');
diff --git a/superset-frontend/packages/superset-ui-core/test/dimension/getBBoxDummyFill.ts b/superset-frontend/packages/superset-ui-core/test/dimension/getBBoxDummyFill.ts
index 8f45793356..29d447a852 100644
--- a/superset-frontend/packages/superset-ui-core/test/dimension/getBBoxDummyFill.ts
+++ b/superset-frontend/packages/superset-ui-core/test/dimension/getBBoxDummyFill.ts
@@ -28,10 +28,10 @@ const textToWidth = {
export const SAMPLE_TEXT = Object.keys(textToWidth);
export function addDummyFill() {
- // @ts-ignore - fix jsdom
+ // @ts-expect-error TS(2339): Property 'getBBox' does not exist on type 'SVGElem... Remove this comment to see the full error message
originalFn = SVGElement.prototype.getBBox;
- // @ts-ignore - fix jsdom
+ // @ts-expect-error TS(2339): Property 'getBBox' does not exist on type 'SVGElem... Remove this comment to see the full error message
SVGElement.prototype.getBBox = function getBBox() {
let width =
textToWidth[this.textContent as keyof typeof textToWidth] || 200;
@@ -78,6 +78,6 @@ export function addDummyFill() {
}
export function removeDummyFill() {
- // @ts-ignore - fix jsdom
+ // @ts-expect-error TS(2339): Property 'getBBox' does not exist on type 'SVGElem... Remove this comment to see the full error message
SVGElement.prototype.getBBox = originalFn;
}
diff --git a/superset-frontend/packages/superset-ui-core/test/dimension/mergeMargin.test.ts b/superset-frontend/packages/superset-ui-core/test/dimension/mergeMargin.test.ts
index 6567605efe..c0feee88e4 100644
--- a/superset-frontend/packages/superset-ui-core/test/dimension/mergeMargin.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/dimension/mergeMargin.test.ts
@@ -187,7 +187,7 @@ describe('mergeMargin(margin1, margin2, mode?)', () => {
mergeMargin(
{
top: 10,
- // @ts-ignore to let us pass `null` for testing
+ // @ts-expect-error TS(2322): Type 'null' is not assignable to type 'number | un... Remove this comment to see the full error message
left: null,
bottom: 20,
right: NaN,
diff --git a/superset-frontend/packages/superset-ui-core/test/models/ExtensibleFunction.test.ts b/superset-frontend/packages/superset-ui-core/test/models/ExtensibleFunction.test.ts
index 931989853d..fe2caedf0a 100644
--- a/superset-frontend/packages/superset-ui-core/test/models/ExtensibleFunction.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/models/ExtensibleFunction.test.ts
@@ -52,9 +52,9 @@ describe('ExtensibleFunction', () => {
x: unknown;
constructor(x: unknown) {
- // @ts-ignore
+ // @ts-expect-error TS(7023): 'customName' implicitly has return type 'any' beca... Remove this comment to see the full error message
super(function customName() {
- // @ts-ignore
+ // @ts-expect-error TS(2339): Property 'x' does not exist on type '() => any'.
return customName.x;
}); // named function
this.x = x;
diff --git a/superset-frontend/packages/superset-ui-core/test/number-format/NumberFormatter.test.ts b/superset-frontend/packages/superset-ui-core/test/number-format/NumberFormatter.test.ts
index 7cb1144444..a45f32d75c 100644
--- a/superset-frontend/packages/superset-ui-core/test/number-format/NumberFormatter.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/number-format/NumberFormatter.test.ts
@@ -24,7 +24,7 @@ describe('NumberFormatter', () => {
it('requires config.id', () => {
expect(
() =>
- // @ts-ignore
+ // @ts-expect-error TS(2345): Argument of type '{ formatFunc: () => string; }' i... Remove this comment to see the full error message
new NumberFormatter({
formatFunc: () => '',
}),
@@ -33,7 +33,7 @@ describe('NumberFormatter', () => {
it('requires config.formatFunc', () => {
expect(
() =>
- // @ts-ignore
+ // @ts-expect-error TS(2345): Argument of type '{ id: string; }' is not assignab... Remove this comment to see the full error message
new NumberFormatter({
id: 'my_format',
}),
diff --git a/superset-frontend/packages/superset-ui-core/test/number-format/NumberFormatterRegistry.test.ts b/superset-frontend/packages/superset-ui-core/test/number-format/NumberFormatterRegistry.test.ts
index 2ff49f155c..d6b272618b 100644
--- a/superset-frontend/packages/superset-ui-core/test/number-format/NumberFormatterRegistry.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/number-format/NumberFormatterRegistry.test.ts
@@ -49,7 +49,7 @@ describe('NumberFormatterRegistry', () => {
});
it('falls back to default format if format is null', () => {
registry.setDefaultKey('.1f');
- // @ts-ignore
+ // @ts-expect-error TS(2345): Argument of type 'null' is not assignable to param... Remove this comment to see the full error message
const formatter = registry.get(null);
expect(formatter.format(100)).toEqual('100.0');
});
diff --git a/superset-frontend/packages/superset-ui-core/test/number-format/factories/createD3NumberFormatter.test.ts b/superset-frontend/packages/superset-ui-core/test/number-format/factories/createD3NumberFormatter.test.ts
index 951ab039c5..43cc48c690 100644
--- a/superset-frontend/packages/superset-ui-core/test/number-format/factories/createD3NumberFormatter.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/number-format/factories/createD3NumberFormatter.test.ts
@@ -21,7 +21,7 @@ import { createD3NumberFormatter } from '@superset-ui/core';
describe('createD3NumberFormatter(config)', () => {
it('requires config.formatString', () => {
- // @ts-ignore -- intentionally pass invalid input
+ // @ts-expect-error TS(2345): Argument of type '{}' is not assignable to paramet... Remove this comment to see the full error message
expect(() => createD3NumberFormatter({})).toThrow();
});
describe('config.formatString', () => {
diff --git a/superset-frontend/packages/superset-ui-core/test/query/api/v1/makeApi.test.ts b/superset-frontend/packages/superset-ui-core/test/query/api/v1/makeApi.test.ts
index d7fcf1c04c..27def41a71 100644
--- a/superset-frontend/packages/superset-ui-core/test/query/api/v1/makeApi.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/query/api/v1/makeApi.test.ts
@@ -145,7 +145,7 @@ describe('makeApi()', () => {
makeApi({
method: 'POST',
endpoint: '/test-formdata',
- // @ts-ignore
+ // @ts-expect-error TS(2322): Type '"text"' is not assignable to type '"search" ... Remove this comment to see the full error message
requestType: 'text',
});
}).toThrow('Invalid request payload type');
diff --git a/superset-frontend/packages/superset-ui-core/test/query/buildQueryObject.test.ts b/superset-frontend/packages/superset-ui-core/test/query/buildQueryObject.test.ts
index fa4858efcb..86cdb53098 100644
--- a/superset-frontend/packages/superset-ui-core/test/query/buildQueryObject.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/query/buildQueryObject.test.ts
@@ -288,7 +288,7 @@ describe('buildQueryObject', () => {
datasource: '5__table',
granularity_sqla: 'ds',
viz_type: VizType.Table,
- // @ts-expect-error
+ // @ts-expect-error TS(2322): Type 'null' is not assignable to type 'Record<stri... Remove this comment to see the full error message
url_params: null,
}).url_params,
).toBeUndefined();
diff --git a/superset-frontend/packages/superset-ui-core/test/query/getClientErrorObject.test.ts b/superset-frontend/packages/superset-ui-core/test/query/getClientErrorObject.test.ts
index 1abbf5c306..0d62238e5d 100644
--- a/superset-frontend/packages/superset-ui-core/test/query/getClientErrorObject.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/query/getClientErrorObject.test.ts
@@ -120,7 +120,7 @@ test('Handles Response that contains raw html be parsed as text', async () => {
test('Handles TypeError Response', async () => {
const error = new TypeError('Failed to fetch');
- // @ts-ignore
+ // @ts-expect-error TS(2345): Argument of type 'TypeError' is not assignable to ... Remove this comment to see the full error message
const errorObj = await getClientErrorObject(error);
expect(errorObj).toMatchObject({ error: 'Network error' });
});
@@ -184,15 +184,15 @@ test('Handles error with status text and message', async () => {
const statusText = 'status';
const message = 'message';
- // @ts-ignore
+ // @ts-expect-error TS(2322): Type '"status"' is not assignable to type '"timeou... Remove this comment to see the full error message
expect(await getClientErrorObject({ statusText, message })).toMatchObject({
error: statusText,
});
- // @ts-ignore
+ // @ts-expect-error TS(2345): Argument of type '{ message: string; }' is not ass... Remove this comment to see the full error message
expect(await getClientErrorObject({ message })).toMatchObject({
error: message,
});
- // @ts-ignore
+ // @ts-expect-error TS(2345): Argument of type '{}' is not assignable to paramet... Remove this comment to see the full error message
expect(await getClientErrorObject({})).toMatchObject({
error: 'An error occurred',
});
diff --git a/superset-frontend/packages/superset-ui-core/test/query/normalizeOrderBy.test.ts b/superset-frontend/packages/superset-ui-core/test/query/normalizeOrderBy.test.ts
index 57f234ebc8..ad27c6635f 100644
--- a/superset-frontend/packages/superset-ui-core/test/query/normalizeOrderBy.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/query/normalizeOrderBy.test.ts
@@ -183,7 +183,7 @@ describe('normalizeOrderBy', () => {
datasource: '5__table',
viz_type: VizType.Table,
time_range: '1 year ago : 2013',
- // @ts-ignore
+ // @ts-expect-error TS(2322): Type 'string' is not assignable to type 'boolean |... Remove this comment to see the full error message
orderby: [['count(*)', 'true']],
};
expect(normalizeOrderBy(query)).not.toHaveProperty('orderby');
diff --git a/superset-frontend/packages/superset-ui-core/test/query/processExtraFormData.test.ts b/superset-frontend/packages/superset-ui-core/test/query/processExtraFormData.test.ts
index b688b03ca9..346cd74b51 100644
--- a/superset-frontend/packages/superset-ui-core/test/query/processExtraFormData.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/query/processExtraFormData.test.ts
@@ -70,7 +70,7 @@ describe('overrideExtraFormData', () => {
time_range: '100 years ago',
},
{
- // @ts-expect-error
+ // @ts-expect-error TS(2345): Argument of type '{ viz_type: string; }' is not as... Remove this comment to see the full error message
viz_type: 'other custom viz',
},
),
diff --git a/superset-frontend/packages/superset-ui-core/test/time-format/TimeFormatter.test.ts b/superset-frontend/packages/superset-ui-core/test/time-format/TimeFormatter.test.ts
index e6353e856d..e68a539653 100644
--- a/superset-frontend/packages/superset-ui-core/test/time-format/TimeFormatter.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/time-format/TimeFormatter.test.ts
@@ -24,7 +24,7 @@ describe('TimeFormatter', () => {
it('requires config.id', () => {
expect(
() =>
- // @ts-ignore -- intentionally pass invalid input
+ // @ts-expect-error TS(2345): Argument of type '{ formatFunc: () => string; }' i... Remove this comment to see the full error message
new TimeFormatter({
formatFunc: () => 'test',
}),
@@ -33,7 +33,7 @@ describe('TimeFormatter', () => {
it('requires config.formatFunc', () => {
expect(
() =>
- // @ts-ignore -- intentionally pass invalid input
+ // @ts-expect-error TS(2345): Argument of type '{ id: string; }' is not assignab... Remove this comment to see the full error message
new TimeFormatter({
id: 'my_format',
}),
diff --git a/superset-frontend/packages/superset-ui-core/test/time-format/TimeFormatterRegistry.test.ts b/superset-frontend/packages/superset-ui-core/test/time-format/TimeFormatterRegistry.test.ts
index 57b659d740..2d760350aa 100644
--- a/superset-frontend/packages/superset-ui-core/test/time-format/TimeFormatterRegistry.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/time-format/TimeFormatterRegistry.test.ts
@@ -45,7 +45,7 @@ describe('TimeFormatterRegistry', () => {
});
it('falls back to default format if format is null', () => {
registry.setDefaultKey(TimeFormats.INTERNATIONAL_DATE);
- // @ts-ignore
+ // @ts-expect-error TS(2345): Argument of type 'null' is not assignable to param... Remove this comment to see the full error message
const formatter = registry.get(null);
expect(formatter.format(PREVIEW_TIME)).toEqual('14/02/2017');
});
diff --git a/superset-frontend/packages/superset-ui-core/test/time-format/factories/createD3TimeFormatter.test.ts b/superset-frontend/packages/superset-ui-core/test/time-format/factories/createD3TimeFormatter.test.ts
index a47e0e2f5b..a4ed855792 100644
--- a/superset-frontend/packages/superset-ui-core/test/time-format/factories/createD3TimeFormatter.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/time-format/factories/createD3TimeFormatter.test.ts
@@ -71,9 +71,9 @@ const thLocale: TimeLocaleDefinition = {
describe('createD3TimeFormatter(config)', () => {
it('requires config.formatString', () => {
- // @ts-ignore
+ // @ts-expect-error TS(2554): Expected 1 arguments, but got 0.
expect(() => createD3TimeFormatter()).toThrow();
- // @ts-ignore
+ // @ts-expect-error TS(2345): Argument of type '{}' is not assignable to paramet... Remove this comment to see the full error message
expect(() => createD3TimeFormatter({})).toThrow();
});
describe('config.useLocalTime', () => {
diff --git a/superset-frontend/packages/superset-ui-core/test/utils/getSelectedText.test.ts b/superset-frontend/packages/superset-ui-core/test/utils/getSelectedText.test.ts
index 75682e9e74..aef884481d 100644
--- a/superset-frontend/packages/superset-ui-core/test/utils/getSelectedText.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/utils/getSelectedText.test.ts
@@ -27,7 +27,7 @@ test('Returns null if Selection object is null', () => {
test('Returns selection text if Selection object is not null', () => {
jest
.spyOn(window, 'getSelection')
- // @ts-ignore
+ // @ts-expect-error TS(2740): Type '{ toString: () => string; }' is missing the ... Remove this comment to see the full error message
.mockImplementationOnce(() => ({ toString: () => 'test string' }));
expect(getSelectedText()).toEqual('test string');
jest.restoreAllMocks();
diff --git a/superset-frontend/packages/superset-ui-core/test/utils/lruCache.test.ts b/superset-frontend/packages/superset-ui-core/test/utils/lruCache.test.ts
index 2c7f1fafa4..db8c53405f 100644
--- a/superset-frontend/packages/superset-ui-core/test/utils/lruCache.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/utils/lruCache.test.ts
@@ -42,9 +42,9 @@ test('LRU operations', () => {
expect(cache.values()).toEqual(['d', 'b', 'e']);
expect(cache.has('2')).toBeTruthy();
expect(cache.has('3')).toBeFalsy();
- // @ts-expect-error
+ // @ts-expect-error TS(2554): Expected 2 arguments, but got 1.
expect(() => cache.set(0)).toThrow(TypeError);
- // @ts-expect-error
+ // @ts-expect-error TS(2345): Argument of type 'number' is not assignable to par... Remove this comment to see the full error message
expect(() => cache.get(0)).toThrow(TypeError);
expect(cache.size).toBe(3);
expect(cache.values()).toEqual(['d', 'b', 'e']);
diff --git a/superset-frontend/plugins/legacy-plugin-chart-calendar/src/Calendar.js b/superset-frontend/plugins/legacy-plugin-chart-calendar/src/Calendar.ts
similarity index 87%
rename from superset-frontend/plugins/legacy-plugin-chart-calendar/src/Calendar.js
rename to superset-frontend/plugins/legacy-plugin-chart-calendar/src/Calendar.ts
index d97557a77b..9658d00d1b 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-calendar/src/Calendar.js
+++ b/superset-frontend/plugins/legacy-plugin-chart-calendar/src/Calendar.ts
@@ -18,6 +18,7 @@
*/
import PropTypes from 'prop-types';
import { extent as d3Extent, range as d3Range } from 'd3-array';
+// @ts-expect-error TS(7016): Could not find a declaration file for module 'd3-s... Remove this comment to see the full error message
import { select as d3Select } from 'd3-selection';
import { getSequentialSchemeRegistry, t } from '@superset-ui/core';
import CalHeatMap from './vendor/cal-heatmap';
@@ -53,7 +54,7 @@ const propTypes = {
theme: PropTypes.object,
};
-function Calendar(element, props) {
+function Calendar(element: $TSFixMe, props: $TSFixMe) {
const {
data,
height,
@@ -80,7 +81,7 @@ function Calendar(element, props) {
const div = container.append('div');
const subDomainTextFormat = showValues
- ? (date, value) => valueFormatter(value)
+ ? (date: $TSFixMe, value: $TSFixMe) => valueFormatter(value)
: null;
const metricsData = data.data;
@@ -95,13 +96,16 @@ function Calendar(element, props) {
const timestamps = metricsData[metric];
const extents = d3Extent(Object.keys(timestamps), key => timestamps[key]);
const step = (extents[1] - extents[0]) / (steps - 1);
+ // @ts-expect-error TS(2532): Object is possibly 'undefined'.
const colorScale = getSequentialSchemeRegistry()
.get(linearColorScheme)
+ // @ts-expect-error TS(2345): Argument of type '[undefined, undefined] | [any, a... Remove this comment to see the full error message
.createLinearScale(extents);
const legend = d3Range(steps).map(i => extents[0] + step * i);
const legendColors = legend.map(x => colorScale(x));
+ // @ts-expect-error TS(7009): 'new' expression, whose target lacks a construct s... Remove this comment to see the full error message
const cal = new CalHeatMap();
cal.init({
start: data.start,
diff --git a/superset-frontend/plugins/legacy-plugin-chart-calendar/src/ReactCalendar.jsx b/superset-frontend/plugins/legacy-plugin-chart-calendar/src/ReactCalendar.tsx
similarity index 99%
rename from superset-frontend/plugins/legacy-plugin-chart-calendar/src/ReactCalendar.jsx
rename to superset-frontend/plugins/legacy-plugin-chart-calendar/src/ReactCalendar.tsx
index 8c8edd1a5e..26259d262d 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-calendar/src/ReactCalendar.jsx
+++ b/superset-frontend/plugins/legacy-plugin-chart-calendar/src/ReactCalendar.tsx
@@ -23,7 +23,7 @@ import Component from './Calendar';
const ReactComponent = reactify(Component);
-const Calendar = ({ className, ...otherProps }) => {
+const Calendar = ({ className, ...otherProps }: $TSFixMe) => {
const theme = useTheme();
return (
<div className={className}>
diff --git a/superset-frontend/plugins/legacy-plugin-chart-calendar/src/index.js b/superset-frontend/plugins/legacy-plugin-chart-calendar/src/index.ts
similarity index 100%
rename from superset-frontend/plugins/legacy-plugin-chart-calendar/src/index.js
rename to superset-frontend/plugins/legacy-plugin-chart-calendar/src/index.ts
diff --git a/superset-frontend/plugins/legacy-plugin-chart-calendar/src/transformProps.js b/superset-frontend/plugins/legacy-plugin-chart-calendar/src/transformProps.ts
similarity index 91%
rename from superset-frontend/plugins/legacy-plugin-chart-calendar/src/transformProps.js
rename to superset-frontend/plugins/legacy-plugin-chart-calendar/src/transformProps.ts
index 379a206f51..6dfb0ee5a9 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-calendar/src/transformProps.js
+++ b/superset-frontend/plugins/legacy-plugin-chart-calendar/src/transformProps.ts
@@ -20,7 +20,7 @@
import { getNumberFormatter } from '@superset-ui/core';
import { getFormattedUTCTime } from './utils';
-export default function transformProps(chartProps) {
+export default function transformProps(chartProps: $TSFixMe) {
const { height, formData, queriesData, datasource } = chartProps;
const {
cellPadding,
@@ -38,7 +38,8 @@ export default function transformProps(chartProps) {
} = formData;
const { verboseMap } = datasource;
- const timeFormatter = ts => getFormattedUTCTime(ts, xAxisTimeFormat);
+ const timeFormatter = (ts: $TSFixMe) =>
+ getFormattedUTCTime(ts, xAxisTimeFormat);
const valueFormatter = getNumberFormatter(yAxisFormat);
return {
diff --git a/superset-frontend/plugins/legacy-plugin-chart-calendar/src/vendor/cal-heatmap.js b/superset-frontend/plugins/legacy-plugin-chart-calendar/src/vendor/cal-heatmap.ts
similarity index 88%
rename from superset-frontend/plugins/legacy-plugin-chart-calendar/src/vendor/cal-heatmap.js
rename to superset-frontend/plugins/legacy-plugin-chart-calendar/src/vendor/cal-heatmap.ts
index 482a315392..01c629bc21 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-calendar/src/vendor/cal-heatmap.js
+++ b/superset-frontend/plugins/legacy-plugin-chart-calendar/src/vendor/cal-heatmap.ts
@@ -8,6 +8,7 @@
/* eslint-disable */
+// @ts-expect-error TS(7016): Could not find a declaration file for module 'd3-t... Remove this comment to see the full error message
import d3tip from 'd3-tip';
import { getContrastingColor, t } from '@superset-ui/core';
@@ -15,7 +16,7 @@ var d3 = typeof require === 'function' ? require('d3') : window.d3;
var d3 = typeof require === 'function' ? require('d3') : window.d3;
-var CalHeatMap = function () {
+var CalHeatMap = function(this: $TSFixMe) {
'use strict';
var self = this;
@@ -24,7 +25,7 @@ var CalHeatMap = function () {
.direction('n')
.offset([-5, 0])
.html(
- d => `
+ (d: $TSFixMe) => `
${self.options.timeFormatter(d.t)}: <strong>${self.options.valueFormatter(
d.v,
)}</strong>
@@ -34,7 +35,7 @@ var CalHeatMap = function () {
.attr('class', 'd3-tip')
.direction('n')
.offset([-5, 0])
- .html(d => self.options.valueFormatter(d));
+ .html((d: $TSFixMe) => self.options.valueFormatter(d));
this.allowedDataType = ['json', 'csv', 'tsv', 'txt'];
@@ -69,9 +70,9 @@ var CalHeatMap = function () {
domainMargin: [0, 0, 0, 0],
- valueFormatter: d => d,
+ valueFormatter: (d: $TSFixMe) => d,
- timeFormatter: d => d,
+ timeFormatter: (d: $TSFixMe) => d,
domain: 'hour',
@@ -296,9 +297,9 @@ var CalHeatMap = function () {
// Used mainly to convert the datas if they're not formatted like expected
// Takes the fetched "data" object as argument, must return a json object
// formatted like {timestamp:count, timestamp2:count2},
- afterLoadData: function (timestamps) {
+ afterLoadData: function (timestamps: $TSFixMe) {
// See https://github.com/wa0x6e/cal-heatmap/issues/126#issuecomment-373301803
- const stdTimezoneOffset = date => {
+ const stdTimezoneOffset = (date: $TSFixMe) => {
const jan = new Date(date.getFullYear(), 0, 1);
const jul = new Date(date.getFullYear(), 6, 1);
return Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset());
@@ -307,7 +308,9 @@ var CalHeatMap = function () {
let results = {};
for (let timestamp in timestamps) {
const value = timestamps[timestamp];
+ // @ts-expect-error TS(2322): Type 'number' is not assignable to type 'string'.
timestamp = parseInt(timestamp, 10);
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
results[timestamp + offset] = value;
}
return results;
@@ -340,17 +343,17 @@ var CalHeatMap = function () {
maxItemNumber: 60,
defaultRowNumber: 10,
defaultColumnNumber: 6,
- row: function (d) {
+ row: function (d: $TSFixMe) {
return self.getSubDomainRowNumber(d);
},
- column: function (d) {
+ column: function (d: $TSFixMe) {
return self.getSubDomainColumnNumber(d);
},
position: {
- x: function (d) {
+ x: function (d: $TSFixMe) {
return Math.floor(d.getMinutes() / self._domainType.min.row(d));
},
- y: function (d) {
+ y: function (d: $TSFixMe) {
return d.getMinutes() % self._domainType.min.row(d);
},
},
@@ -359,7 +362,7 @@ var CalHeatMap = function () {
legend: '',
connector: 'at',
},
- extractUnit: function (d) {
+ extractUnit: function (d: $TSFixMe) {
return new Date(
d.getFullYear(),
d.getMonth(),
@@ -372,7 +375,8 @@ var CalHeatMap = function () {
hour: {
name: 'hour',
level: 20,
- maxItemNumber: function (d) {
+ // @ts-expect-error TS(7030): Not all code paths return a value.
+ maxItemNumber: function (d: $TSFixMe) {
switch (self.options.domain) {
case 'day':
return 24;
@@ -388,7 +392,7 @@ var CalHeatMap = function () {
}
},
defaultRowNumber: 6,
- defaultColumnNumber: function (d) {
+ defaultColumnNumber: function (d: $TSFixMe) {
switch (self.options.domain) {
case 'day':
return 4;
@@ -400,14 +404,14 @@ var CalHeatMap = function () {
: 31;
}
},
- row: function (d) {
+ row: function (d: $TSFixMe) {
return self.getSubDomainRowNumber(d);
},
- column: function (d) {
+ column: function (d: $TSFixMe) {
return self.getSubDomainColumnNumber(d);
},
position: {
- x: function (d) {
+ x: function (d: $TSFixMe) {
if (self.options.domain === 'month') {
if (self.options.colLimit > 0 || self.options.rowLimit > 0) {
return Math.floor(
@@ -433,7 +437,7 @@ var CalHeatMap = function () {
}
return Math.floor(d.getHours() / self._domainType.hour.row(d));
},
- y: function (d) {
+ y: function (d: $TSFixMe) {
var p = d.getHours();
if (self.options.colLimit > 0 || self.options.rowLimit > 0) {
switch (self.options.domain) {
@@ -453,7 +457,7 @@ var CalHeatMap = function () {
legend: '%H:00',
connector: 'at',
},
- extractUnit: function (d) {
+ extractUnit: function (d: $TSFixMe) {
return new Date(
d.getFullYear(),
d.getMonth(),
@@ -465,7 +469,7 @@ var CalHeatMap = function () {
day: {
name: 'day',
level: 30,
- maxItemNumber: function (d) {
+ maxItemNumber: function (d: $TSFixMe) {
switch (self.options.domain) {
case 'week':
return 7;
@@ -479,7 +483,8 @@ var CalHeatMap = function () {
: 366;
}
},
- defaultColumnNumber: function (d) {
+ // @ts-expect-error TS(7030): Not all code paths return a value.
+ defaultColumnNumber: function (d: $TSFixMe) {
d = new Date(d);
switch (self.options.domain) {
case 'week':
@@ -502,14 +507,14 @@ var CalHeatMap = function () {
}
},
defaultRowNumber: 7,
- row: function (d) {
+ row: function (d: $TSFixMe) {
return self.getSubDomainRowNumber(d);
},
- column: function (d) {
+ column: function (d: $TSFixMe) {
return self.getSubDomainColumnNumber(d);
},
position: {
- x: function (d) {
+ x: function (d: $TSFixMe) {
switch (self.options.domain) {
case 'week':
return Math.floor(
@@ -534,7 +539,7 @@ var CalHeatMap = function () {
return self.getWeekNumber(d);
}
},
- y: function (d) {
+ y: function (d: $TSFixMe) {
var p = self.getWeekDay(d);
if (self.options.colLimit > 0 || self.options.rowLimit > 0) {
switch (self.options.domain) {
@@ -557,7 +562,7 @@ var CalHeatMap = function () {
legend: '%e %b',
connector: 'on',
},
- extractUnit: function (d) {
+ extractUnit: function (d: $TSFixMe) {
return new Date(d.getFullYear(), d.getMonth(), d.getDate()).getTime();
},
},
@@ -565,7 +570,7 @@ var CalHeatMap = function () {
name: 'week',
level: 40,
maxItemNumber: 54,
- defaultColumnNumber: function (d) {
+ defaultColumnNumber: function (d: $TSFixMe) {
d = new Date(d);
switch (self.options.domain) {
case 'year':
@@ -579,14 +584,15 @@ var CalHeatMap = function () {
}
},
defaultRowNumber: 1,
- row: function (d) {
+ row: function (d: $TSFixMe) {
return self.getSubDomainRowNumber(d);
},
- column: function (d) {
+ column: function (d: $TSFixMe) {
return self.getSubDomainColumnNumber(d);
},
position: {
- x: function (d) {
+ // @ts-expect-error TS(7030): Not all code paths return a value.
+ x: function (d: $TSFixMe) {
switch (self.options.domain) {
case 'year':
return Math.floor(
@@ -598,7 +604,7 @@ var CalHeatMap = function () {
);
}
},
- y: function (d) {
+ y: function (d: $TSFixMe) {
return self.getWeekNumber(d) % self._domainType.week.row(d);
},
},
@@ -607,7 +613,7 @@ var CalHeatMap = function () {
legend: '%B Week #%W',
connector: 'in',
},
- extractUnit: function (d) {
+ extractUnit: function (d: $TSFixMe) {
var dt = new Date(d.getFullYear(), d.getMonth(), d.getDate());
// According to ISO-8601, week number computation are based on week starting on Monday
var weekDay = dt.getDay() - (self.options.weekStartOnMonday ? 1 : 0);
@@ -631,10 +637,10 @@ var CalHeatMap = function () {
return self.getSubDomainColumnNumber();
},
position: {
- x: function (d) {
+ x: function (d: $TSFixMe) {
return Math.floor(d.getMonth() / self._domainType.month.row(d));
},
- y: function (d) {
+ y: function (d: $TSFixMe) {
return d.getMonth() % self._domainType.month.row(d);
},
},
@@ -643,7 +649,7 @@ var CalHeatMap = function () {
legend: '%B',
connector: 'in',
},
- extractUnit: function (d) {
+ extractUnit: function (d: $TSFixMe) {
return new Date(d.getFullYear(), d.getMonth()).getTime();
},
},
@@ -669,7 +675,7 @@ var CalHeatMap = function () {
legend: '%Y',
connector: 'in',
},
- extractUnit: function (d) {
+ extractUnit: function (d: $TSFixMe) {
return new Date(d.getFullYear()).getTime();
},
},
@@ -731,6 +737,7 @@ var CalHeatMap = function () {
this._maxDomainReached = false;
this._minDomainReached = false;
+ // @ts-expect-error TS(7009): 'new' expression, whose target lacks a construct s... Remove this comment to see the full error message
this.domainPosition = new DomainPosition();
this.Legend = null;
this.legendScale = null;
@@ -746,13 +753,13 @@ var CalHeatMap = function () {
this._init = function () {
self
.getDomain(self.options.start)
- .map(function (d) {
+ .map(function (d: $TSFixMe) {
return d.getTime();
})
- .map(function (d) {
+ .map(function (d: $TSFixMe) {
self._domains.set(
d,
- self.getSubDomain(d).map(function (d) {
+ self.getSubDomain(d).map(function (d: $TSFixMe) {
return {
t: self._domainType[self.options.subDomain].extractUnit(d),
v: null,
@@ -768,6 +775,7 @@ var CalHeatMap = function () {
self.root.attr('x', 0).attr('y', 0).append('svg').attr('class', 'graph');
+ // @ts-expect-error TS(7009): 'new' expression, whose target lacks a construct s... Remove this comment to see the full error message
self.Legend = new Legend(self);
if (self.options.paintOnLoad) {
@@ -857,7 +865,7 @@ var CalHeatMap = function () {
// Return the width of the domain block, without the domain gutter
// @param int d Domain start timestamp
- function w(d, outer) {
+ function w(d: $TSFixMe, outer: $TSFixMe) {
var width =
self.options.cellSize *
self._domainType[self.options.subDomain].column(d) +
@@ -874,7 +882,7 @@ var CalHeatMap = function () {
}
// Return the height of the domain block, without the domain gutter
- function h(d, outer) {
+ function h(d: $TSFixMe, outer: $TSFixMe) {
var height =
self.options.cellSize * self._domainType[self.options.subDomain].row(d) +
self.options.cellPadding *
@@ -894,7 +902,7 @@ var CalHeatMap = function () {
*
* @param int navigationDir
*/
- this.paint = function (navigationDir) {
+ this.paint = function (navigationDir: $TSFixMe) {
var options = self.options;
if (arguments.length === 0) {
@@ -910,7 +918,7 @@ var CalHeatMap = function () {
var data = self.getDomainKeys();
return navigationDir === self.NAVIGATE_LEFT ? data.reverse() : data;
},
- function (d) {
+ function (d: $TSFixMe) {
return d;
},
);
@@ -924,13 +932,13 @@ var CalHeatMap = function () {
var svg = domainSvg
.enter()
.append('svg')
- .attr('width', function (d) {
+ .attr('width', function (d: $TSFixMe) {
return w(d, true);
})
- .attr('height', function (d) {
+ .attr('height', function (d: $TSFixMe) {
return h(d, true);
})
- .attr('x', function (d) {
+ .attr('x', function (d: $TSFixMe) {
if (options.verticalOrientation) {
self.graphDim.width = Math.max(self.graphDim.width, w(d, true));
return 0;
@@ -938,7 +946,7 @@ var CalHeatMap = function () {
return getDomainPosition(d, self.graphDim, 'width', w(d, true));
}
})
- .attr('y', function (d) {
+ .attr('y', function (d: $TSFixMe) {
if (options.verticalOrientation) {
return getDomainPosition(d, self.graphDim, 'height', h(d, true));
} else {
@@ -946,7 +954,7 @@ var CalHeatMap = function () {
return 0;
}
})
- .attr('class', function (d) {
+ .attr('class', function (d: $TSFixMe) {
var classname = 'graph-domain';
var date = new Date(d);
switch (options.domain) {
@@ -969,7 +977,7 @@ var CalHeatMap = function () {
});
self.lastInsertedSvg = svg;
- function getDomainPosition(domainIndex, graphDim, axis, domainDim) {
+ function getDomainPosition(domainIndex: $TSFixMe, graphDim: $TSFixMe, axis: $TSFixMe, domainDim: $TSFixMe) {
var tmp = 0;
switch (navigationDir) {
case false:
@@ -1002,10 +1010,10 @@ var CalHeatMap = function () {
svg
.append('rect')
- .attr('width', function (d) {
+ .attr('width', function (d: $TSFixMe) {
return w(d, true) - options.domainGutter - options.cellPadding;
})
- .attr('height', function (d) {
+ .attr('height', function (d: $TSFixMe) {
return h(d, true) - options.domainGutter - options.cellPadding;
})
.attr('class', 'domain-background');
@@ -1032,14 +1040,14 @@ var CalHeatMap = function () {
.attr('class', 'graph-subdomain-group');
var rect = subDomainSvgGroup
.selectAll('g')
- .data(function (d) {
+ .data(function (d: $TSFixMe) {
return self._domains.get(d);
})
.enter()
.append('g');
rect
.append('rect')
- .attr('class', function (d) {
+ .attr('class', function (d: $TSFixMe) {
return (
'graph-rect' +
self.getHighlightClassName(d.t) +
@@ -1048,18 +1056,18 @@ var CalHeatMap = function () {
})
.attr('width', options.cellSize)
.attr('height', options.cellSize)
- .attr('x', function (d) {
+ .attr('x', function (d: $TSFixMe) {
return self.positionSubDomainX(d.t);
})
- .attr('y', function (d) {
+ .attr('y', function (d: $TSFixMe) {
return self.positionSubDomainY(d.t);
})
- .on('click', function (d) {
+ .on('click', function (d: $TSFixMe) {
if (options.onClick !== null) {
return self.onClick(new Date(d.t), d.v);
}
})
- .call(function (selection) {
+ .call(function (selection: $TSFixMe) {
if (options.cellRadius > 0) {
selection
.attr('rx', options.cellRadius)
@@ -1076,7 +1084,7 @@ var CalHeatMap = function () {
if (options.tooltip) {
selection
- .on('mouseover', function (d) {
+ .on('mouseover', function(this: $TSFixMe, d: $TSFixMe) {
self.tip.show(d, this);
})
.on('mouseout', function () {
@@ -1087,7 +1095,7 @@ var CalHeatMap = function () {
// Appending a title to each subdomain
if (!options.tooltip) {
- rect.append('title').text(function (d) {
+ rect.append('title').text(function (d: $TSFixMe) {
return self.formatDate(new Date(d.t), options.subDomainDateFormat);
});
}
@@ -1099,13 +1107,14 @@ var CalHeatMap = function () {
svg
.append('text')
.attr('class', 'graph-label')
- .attr('y', function (d) {
+ .attr('y', function (d: $TSFixMe) {
var y = options.domainMargin[0];
switch (options.label.position) {
case 'top':
y += self.domainVerticalLabelHeight / 2;
break;
case 'bottom':
+ // @ts-expect-error TS(2554): Expected 2 arguments, but got 1.
y += h(d) + self.domainVerticalLabelHeight / 2;
}
@@ -1120,14 +1129,16 @@ var CalHeatMap = function () {
: 1)
);
})
- .attr('x', function (d) {
+ .attr('x', function (d: $TSFixMe) {
var x = options.domainMargin[3];
switch (options.label.position) {
case 'right':
+ // @ts-expect-error TS(2554): Expected 2 arguments, but got 1.
x += w(d);
break;
case 'bottom':
case 'top':
+ // @ts-expect-error TS(2554): Expected 2 arguments, but got 1.
x += w(d) / 2;
}
@@ -1156,19 +1167,20 @@ var CalHeatMap = function () {
.attr('dominant-baseline', function () {
return self.verticalDomainLabel ? 'middle' : 'top';
})
- .text(function (d) {
+ .text(function (d: $TSFixMe) {
return self.formatDate(new Date(d), options.domainLabelFormat);
})
.call(domainRotate);
}
- function domainRotate(selection) {
+ function domainRotate(selection: $TSFixMe) {
switch (options.label.rotate) {
case 'right':
- selection.attr('transform', function (d) {
+ selection.attr('transform', function (d: $TSFixMe) {
var s = 'rotate(90), ';
switch (options.label.position) {
case 'right':
+ // @ts-expect-error TS(2554): Expected 2 arguments, but got 1.
s += 'translate(-' + w(d) + ' , -' + w(d) + ')';
break;
case 'left':
@@ -1180,14 +1192,16 @@ var CalHeatMap = function () {
});
break;
case 'left':
- selection.attr('transform', function (d) {
+ selection.attr('transform', function (d: $TSFixMe) {
var s = 'rotate(270), ';
switch (options.label.position) {
case 'right':
s +=
'translate(-' +
+ // @ts-expect-error TS(2554): Expected 2 arguments, but got 1.
(w(d) + self.domainHorizontalLabelWidth) +
' , ' +
+ // @ts-expect-error TS(2554): Expected 2 arguments, but got 1.
w(d) +
')';
break;
@@ -1213,18 +1227,18 @@ var CalHeatMap = function () {
if (options.subDomainTextFormat !== null) {
rect
.append('text')
- .attr('class', function (d) {
+ .attr('class', function (d: $TSFixMe) {
return 'subdomain-text' + self.getHighlightClassName(d.t);
})
- .attr('x', function (d) {
+ .attr('x', function (d: $TSFixMe) {
return self.positionSubDomainX(d.t) + options.cellSize / 2;
})
- .attr('y', function (d) {
+ .attr('y', function (d: $TSFixMe) {
return self.positionSubDomainY(d.t) + options.cellSize / 2;
})
.attr('text-anchor', 'middle')
.attr('dominant-baseline', 'central')
- .text(function (d) {
+ .text(function (d: $TSFixMe) {
return self.formatDate(new Date(d.t), options.subDomainTextFormat);
});
}
@@ -1237,12 +1251,12 @@ var CalHeatMap = function () {
domainSvg
.transition()
.duration(options.animationDuration)
- .attr('x', function (d) {
+ .attr('x', function (d: $TSFixMe) {
return options.verticalOrientation
? 0
: self.domainPosition.getPosition(d);
})
- .attr('y', function (d) {
+ .attr('y', function (d: $TSFixMe) {
return options.verticalOrientation
? self.domainPosition.getPosition(d)
: 0;
@@ -1263,7 +1277,8 @@ var CalHeatMap = function () {
.exit()
.transition()
.duration(options.animationDuration)
- .attr('x', function (d) {
+ // @ts-expect-error TS(7030): Not all code paths return a value.
+ .attr('x', function (d: $TSFixMe) {
if (options.verticalOrientation) {
return 0;
} else {
@@ -1275,7 +1290,8 @@ var CalHeatMap = function () {
}
}
})
- .attr('y', function (d) {
+ // @ts-expect-error TS(7030): Not all code paths return a value.
+ .attr('y', function (d: $TSFixMe) {
if (options.verticalOrientation) {
switch (navigationDir) {
case self.NAVIGATE_LEFT:
@@ -1302,7 +1318,7 @@ CalHeatMap.prototype = {
* @return {bool} False if settings contains error
*/
/* jshint maxstatements:false */
- init: function (settings) {
+ init: function (settings: $TSFixMe) {
'use strict';
var parent = this;
@@ -1406,7 +1422,7 @@ CalHeatMap.prototype = {
* @throws {Error} If the selector is not valid
* @return {bool} True if the selector is a valid queryString
*/
- function validateSelector(selector, canBeFalse, name) {
+ function validateSelector(selector: $TSFixMe, canBeFalse: $TSFixMe, name: $TSFixMe) {
if (
((canBeFalse && selector === false) ||
selector instanceof Element ||
@@ -1424,7 +1440,7 @@ CalHeatMap.prototype = {
* @param {string} domain a domain name
* @return {string} the subDomain name
*/
- function getOptimalSubDomain(domain) {
+ function getOptimalSubDomain(domain: $TSFixMe) {
switch (domain) {
case 'year':
return 'month';
@@ -1553,7 +1569,7 @@ CalHeatMap.prototype = {
* @param {integer|array} value
* @return {array} array
*/
- function expandMarginSetting(value) {
+ function expandMarginSetting(value: $TSFixMe) {
if (typeof value === 'number') {
value = [value];
}
@@ -1583,7 +1599,7 @@ CalHeatMap.prototype = {
* @param {string|array} value Date to convert
* @return {array} An array like [singular-form, plural-form]
*/
- function expandItemName(value) {
+ function expandItemName(value: $TSFixMe) {
if (typeof value === 'string') {
return [value, value + (value !== '' ? 's' : '')];
}
@@ -1601,11 +1617,11 @@ CalHeatMap.prototype = {
return ['item', 'items'];
}
- function parseColLimit(value) {
+ function parseColLimit(value: $TSFixMe) {
return value > 0 ? value : null;
}
- function parseRowLimit(value) {
+ function parseRowLimit(value: $TSFixMe) {
if (value > 0 && options.colLimit > 0) {
console.log(
'colLimit and rowLimit are mutually exclusive, rowLimit will be ignored',
@@ -1624,7 +1640,7 @@ CalHeatMap.prototype = {
* @param {string|array|Date} value Data to convert
* @return {array} An array of Dates
*/
- expandDateSetting: function (value) {
+ expandDateSetting: function (value: $TSFixMe) {
'use strict';
if (!Array.isArray(value)) {
@@ -1632,7 +1648,7 @@ CalHeatMap.prototype = {
}
return value
- .map(function (data) {
+ .map(function (data: $TSFixMe) {
if (data === 'now') {
return new Date();
}
@@ -1641,7 +1657,7 @@ CalHeatMap.prototype = {
}
return false;
})
- .filter(function (d) {
+ .filter(function (d: $TSFixMe) {
return d !== false;
});
},
@@ -1653,7 +1669,7 @@ CalHeatMap.prototype = {
* It's used to limit the painting to only a subset of the calendar
* @return void
*/
- fill: function (svg) {
+ fill: function (svg: $TSFixMe) {
'use strict';
var parent = this;
@@ -1666,18 +1682,19 @@ CalHeatMap.prototype = {
var rect = svg
.selectAll('svg')
.selectAll('g')
- .data(function (d) {
+ .data(function (d: $TSFixMe) {
return parent._domains.get(d);
});
/**
* Colorize the cell via a style attribute if enabled
*/
- function addStyle(element) {
+ // @ts-expect-error TS(7030): Not all code paths return a value.
+ function addStyle(element: $TSFixMe) {
if (parent.legendScale === null) {
return false;
}
- element.attr('fill', function (d) {
+ element.attr('fill', function (d: $TSFixMe) {
if (
d.v === null &&
options.hasOwnProperty('considerMissingDataAsZero') &&
@@ -1718,7 +1735,7 @@ CalHeatMap.prototype = {
.transition()
.duration(options.animationDuration)
.select('rect')
- .attr('class', function (d) {
+ .attr('class', function (d: $TSFixMe) {
var htmlClass = parent.getHighlightClassName(d.t).trim().split(' ');
var pastDate = parent.dateIsLessThan(d.t, new Date());
var sameDate = parent.dateIsEqual(d.t, new Date());
@@ -1761,13 +1778,13 @@ CalHeatMap.prototype = {
.transition()
.duration(options.animationDuration)
.select('title')
- .text(function (d) {
+ .text(function (d: $TSFixMe) {
return parent.getSubDomainTitle(d);
});
- function formatSubDomainText(element) {
+ function formatSubDomainText(element: $TSFixMe) {
if (typeof options.subDomainTextFormat === 'function') {
- element.text(function (d) {
+ element.text(function (d: $TSFixMe) {
return options.subDomainTextFormat(d.t, d.v);
});
}
@@ -1782,11 +1799,11 @@ CalHeatMap.prototype = {
.transition()
.duration(options.animationDuration)
.select('text')
- .attr('class', function (d) {
+ .attr('class', function (d: $TSFixMe) {
return 'subdomain-text' + parent.getHighlightClassName(d.t);
})
.call(formatSubDomainText)
- .attr('fill', d => {
+ .attr('fill', (d: $TSFixMe) => {
if (!d.v) return '#000';
const rgb = parent.legendScale(
Math.min(d.v, options.legend[options.legend.length - 1]),
@@ -1804,7 +1821,7 @@ CalHeatMap.prototype = {
*
* @return String
*/
- formatStringWithObject: function (formatted, args) {
+ formatStringWithObject: function (formatted: $TSFixMe, args: $TSFixMe) {
'use strict';
for (var prop in args) {
if (args.hasOwnProperty(prop)) {
@@ -1827,7 +1844,7 @@ CalHeatMap.prototype = {
* @param boolean skip Whether to skip the event triggering
* @return mixed True when the triggering was skipped, false on error, else the callback function
*/
- triggerEvent: function (eventName, successArgs, skip) {
+ triggerEvent: function (eventName: $TSFixMe, successArgs: $TSFixMe, skip: $TSFixMe) {
'use strict';
if ((arguments.length === 3 && skip) || this.options[eventName] === null) {
@@ -1851,7 +1868,7 @@ CalHeatMap.prototype = {
* @param Date d Date of the subdomain block
* @param int itemNb Number of items in that date
*/
- onClick: function (d, itemNb) {
+ onClick: function (d: $TSFixMe, itemNb: $TSFixMe) {
'use strict';
return this.triggerEvent('onClick', [d, itemNb]);
@@ -1883,7 +1900,7 @@ CalHeatMap.prototype = {
* @param Date start Domain start date
* @param Date end Domain end date
*/
- afterLoadPreviousDomain: function (start) {
+ afterLoadPreviousDomain: function (start: $TSFixMe) {
'use strict';
var parent = this;
@@ -1899,7 +1916,7 @@ CalHeatMap.prototype = {
* @param Date start Domain start date
* @param Date end Domain end date
*/
- afterLoadNextDomain: function (start) {
+ afterLoadNextDomain: function (start: $TSFixMe) {
'use strict';
var parent = this;
@@ -1914,7 +1931,7 @@ CalHeatMap.prototype = {
*
* @param boolean reached True if the leftmost domain was reached
*/
- onMinDomainReached: function (reached) {
+ onMinDomainReached: function (reached: $TSFixMe) {
'use strict';
this._minDomainReached = reached;
@@ -1926,14 +1943,14 @@ CalHeatMap.prototype = {
*
* @param boolean reached True if the rightmost domain was reached
*/
- onMaxDomainReached: function (reached) {
+ onMaxDomainReached: function (reached: $TSFixMe) {
'use strict';
this._maxDomainReached = reached;
return this.triggerEvent('onMaxDomainReached', [reached]);
},
- checkIfMinDomainIsReached: function (date, upperBound) {
+ checkIfMinDomainIsReached: function (date: $TSFixMe, upperBound: $TSFixMe) {
'use strict';
if (this.minDomainIsReached(date)) {
@@ -1947,7 +1964,7 @@ CalHeatMap.prototype = {
}
},
- checkIfMaxDomainIsReached: function (date, lowerBound) {
+ checkIfMaxDomainIsReached: function (date: $TSFixMe, lowerBound: $TSFixMe) {
'use strict';
if (this.maxDomainIsReached(date)) {
@@ -1973,7 +1990,7 @@ CalHeatMap.prototype = {
formatNumber: d3.format(',g'),
- formatDate: function (d, format) {
+ formatDate: function (d: $TSFixMe, format: $TSFixMe) {
'use strict';
if (arguments.length < 2) {
@@ -1988,7 +2005,7 @@ CalHeatMap.prototype = {
}
},
- getSubDomainTitle: function (d) {
+ getSubDomainTitle: function (d: $TSFixMe) {
'use strict';
if (d.v === null && !this.options.considerMissingDataAsZero) {
@@ -2035,7 +2052,7 @@ CalHeatMap.prototype = {
* @param int n Number of domains to load
* @return bool True if the next domain was loaded, else false
*/
- loadNextDomain: function (n) {
+ loadNextDomain: function (n: $TSFixMe) {
'use strict';
if (this._maxDomainReached || n === 0) {
@@ -2061,7 +2078,7 @@ CalHeatMap.prototype = {
* @param int n Number of domains to load
* @return bool True if the previous domain was loaded, else false
*/
- loadPreviousDomain: function (n) {
+ loadPreviousDomain: function (n: $TSFixMe) {
'use strict';
if (this._minDomainReached || n === 0) {
@@ -2079,7 +2096,7 @@ CalHeatMap.prototype = {
return true;
},
- loadNewDomains: function (direction, newDomains) {
+ loadNewDomains: function (direction: $TSFixMe, newDomains: $TSFixMe) {
'use strict';
var parent = this;
@@ -2088,7 +2105,7 @@ CalHeatMap.prototype = {
var total = newDomains.length;
var domains = this.getDomainKeys();
- function buildSubDomain(d) {
+ function buildSubDomain(d: $TSFixMe) {
return {
t: parent._domainType[parent.options.subDomain].extractUnit(d),
v: null,
@@ -2147,7 +2164,7 @@ CalHeatMap.prototype = {
* @param int datetimestamp The timestamp in ms to test
* @return bool True if the specified date correspond to the calendar upper bound
*/
- maxDomainIsReached: function (datetimestamp) {
+ maxDomainIsReached: function (datetimestamp: $TSFixMe) {
'use strict';
return (
@@ -2162,7 +2179,7 @@ CalHeatMap.prototype = {
* @param int datetimestamp The timestamp in ms to test
* @return bool True if the specified date correspond to the calendar lower bound
*/
- minDomainIsReached: function (datetimestamp) {
+ minDomainIsReached: function (datetimestamp: $TSFixMe) {
'use strict';
return (
@@ -2181,10 +2198,10 @@ CalHeatMap.prototype = {
return this._domains
.keys()
- .map(function (d) {
+ .map(function (d: $TSFixMe) {
return parseInt(d, 10);
})
- .sort(function (a, b) {
+ .sort(function (a: $TSFixMe, b: $TSFixMe) {
return a - b;
});
},
@@ -2193,7 +2210,7 @@ CalHeatMap.prototype = {
// POSITIONNING //
// =========================================================================//
- positionSubDomainX: function (d) {
+ positionSubDomainX: function (d: $TSFixMe) {
'use strict';
var index = this._domainType[this.options.subDomain].position.x(
@@ -2202,7 +2219,7 @@ CalHeatMap.prototype = {
return index * this.options.cellSize + index * this.options.cellPadding;
},
- positionSubDomainY: function (d) {
+ positionSubDomainY: function (d: $TSFixMe) {
'use strict';
var index = this._domainType[this.options.subDomain].position.y(
@@ -2211,7 +2228,7 @@ CalHeatMap.prototype = {
return index * this.options.cellSize + index * this.options.cellPadding;
},
- getSubDomainColumnNumber: function (d) {
+ getSubDomainColumnNumber: function (d: $TSFixMe) {
'use strict';
if (this.options.rowLimit > 0) {
@@ -2229,7 +2246,7 @@ CalHeatMap.prototype = {
return this.options.colLimit || j;
},
- getSubDomainRowNumber: function (d) {
+ getSubDomainRowNumber: function (d: $TSFixMe) {
'use strict';
if (this.options.colLimit > 0) {
@@ -2253,7 +2270,7 @@ CalHeatMap.prototype = {
* @param timestamp date Date of the current subDomain
* @return String the highlight class
*/
- getHighlightClassName: function (d) {
+ getHighlightClassName: function (d: $TSFixMe) {
'use strict';
d = new Date(d);
@@ -2277,7 +2294,7 @@ CalHeatMap.prototype = {
* @param Date d The date to compare
* @return bool True if the date correspond to a subdomain cell
*/
- isNow: function (d) {
+ isNow: function (d: $TSFixMe) {
'use strict';
return this.dateIsEqual(d, new Date());
@@ -2293,7 +2310,7 @@ CalHeatMap.prototype = {
* @return bool true if the 2 dates are equals
*/
/* jshint maxcomplexity: false */
- dateIsEqual: function (dateA, dateB) {
+ dateIsEqual: function (dateA: $TSFixMe, dateB: $TSFixMe) {
'use strict';
if (!(dateA instanceof Date)) {
@@ -2353,7 +2370,7 @@ CalHeatMap.prototype = {
* @param dateB may be a number or a Date
* @returns {boolean}
*/
- dateIsLessThan: function (dateA, dateB) {
+ dateIsLessThan: function (dateA: $TSFixMe, dateB: $TSFixMe) {
'use strict';
if (!(dateA instanceof Date)) {
@@ -2364,7 +2381,7 @@ CalHeatMap.prototype = {
dateB = new Date(dateB);
}
- function normalizedMillis(date, subdomain) {
+ function normalizedMillis(date: $TSFixMe, subdomain: $TSFixMe) {
switch (subdomain) {
case 'x_min':
case 'min':
@@ -2422,7 +2439,7 @@ CalHeatMap.prototype = {
* Monday as the first day of the week
* @return int Week number [0-53]
*/
- getWeekNumber: function (d) {
+ getWeekNumber: function (d: $TSFixMe) {
'use strict';
var f =
@@ -2438,7 +2455,7 @@ CalHeatMap.prototype = {
* @param int|Date d Date or timestamp in milliseconds
* @return int Week number, relative to the month [0-5]
*/
- getMonthWeekNumber: function (d) {
+ getMonthWeekNumber: function (d: $TSFixMe) {
'use strict';
if (typeof d === 'number') {
@@ -2457,7 +2474,7 @@ CalHeatMap.prototype = {
* @param int|Date d Date or timestamp in milliseconds
* @return int Number of weeks in the date's year
*/
- getWeekNumberInYear: function (d) {
+ getWeekNumberInYear: function (d: $TSFixMe) {
'use strict';
if (typeof d === 'number') {
@@ -2471,7 +2488,7 @@ CalHeatMap.prototype = {
* @param int|Date d Date or timestamp in milliseconds
* @return int Number of days in the date's month
*/
- getDayCountInMonth: function (d) {
+ getDayCountInMonth: function (d: $TSFixMe) {
'use strict';
return this.getEndOfMonth(d).getDate();
@@ -2483,7 +2500,7 @@ CalHeatMap.prototype = {
* @param int|Date d Date or timestamp in milliseconds
* @return int Number of days in the date's year
*/
- getDayCountInYear: function (d) {
+ getDayCountInYear: function (d: $TSFixMe) {
'use strict';
if (typeof d === 'number') {
@@ -2501,7 +2518,7 @@ CalHeatMap.prototype = {
* @param Date d
* @return int The week day number (0-6)
*/
- getWeekDay: function (d) {
+ getWeekDay: function (d: $TSFixMe) {
'use strict';
if (this.options.weekStartOnMonday === false) {
@@ -2515,7 +2532,7 @@ CalHeatMap.prototype = {
* @param Date|int d Date or timestamp in milliseconds
* @return Date Last day of the month
*/
- getEndOfMonth: function (d) {
+ getEndOfMonth: function (d: $TSFixMe) {
'use strict';
if (typeof d === 'number') {
@@ -2531,7 +2548,7 @@ CalHeatMap.prototype = {
* @param string step
* @return Date
*/
- jumpDate: function (date, count, step) {
+ jumpDate: function (date: $TSFixMe, count: $TSFixMe, step: $TSFixMe) {
'use strict';
var d = new Date(date);
@@ -2566,7 +2583,7 @@ CalHeatMap.prototype = {
* @param int|date range Number of minutes in the range, or a stop date
* @return array An array of minutes
*/
- getMinuteDomain: function (d, range) {
+ getMinuteDomain: function (d: $TSFixMe, range: $TSFixMe) {
'use strict';
var start = new Date(
@@ -2586,6 +2603,7 @@ CalHeatMap.prototype = {
} else {
stop = new Date(+start + range * 1000 * 60);
}
+ // @ts-expect-error TS(2345): Argument of type 'Date' is not assignable to param... Remove this comment to see the full error message
return d3.time.minutes(Math.min(start, stop), Math.max(start, stop));
},
@@ -2596,7 +2614,7 @@ CalHeatMap.prototype = {
* @param int|date range Number of hours in the range, or a stop date
* @return array An array of hours
*/
- getHourDomain: function (d, range) {
+ getHourDomain: function (d: $TSFixMe, range: $TSFixMe) {
'use strict';
var start = new Date(
@@ -2618,6 +2636,7 @@ CalHeatMap.prototype = {
stop.setHours(stop.getHours() + range);
}
+ // @ts-expect-error TS(2345): Argument of type 'Date' is not assignable to param... Remove this comment to see the full error message
var domains = d3.time.hours(Math.min(start, stop), Math.max(start, stop));
// Passing from DST to standard time
@@ -2649,7 +2668,7 @@ CalHeatMap.prototype = {
* @param int|date range Number of days in the range, or a stop date
* @return array An array of weeks
*/
- getDayDomain: function (d, range) {
+ getDayDomain: function (d: $TSFixMe, range: $TSFixMe) {
'use strict';
var start = new Date(d.getFullYear(), d.getMonth(), d.getDate());
@@ -2661,6 +2680,7 @@ CalHeatMap.prototype = {
stop = new Date(stop.setDate(stop.getDate() + parseInt(range, 10)));
}
+ // @ts-expect-error TS(2345): Argument of type 'Date' is not assignable to param... Remove this comment to see the full error message
return d3.time.days(Math.min(start, stop), Math.max(start, stop));
},
@@ -2671,7 +2691,7 @@ CalHeatMap.prototype = {
* @param int|date range Number of minutes in the range, or a stop date
* @return array An array of weeks
*/
- getWeekDomain: function (d, range) {
+ getWeekDomain: function (d: $TSFixMe, range: $TSFixMe) {
'use strict';
var weekStart;
@@ -2705,7 +2725,9 @@ CalHeatMap.prototype = {
}
return this.options.weekStartOnMonday === true
+ // @ts-expect-error TS(2345): Argument of type 'Date' is not assignable to param... Remove this comment to see the full error message
? d3.time.mondays(Math.min(weekStart, stop), Math.max(weekStart, stop))
+ // @ts-expect-error TS(2345): Argument of type 'Date' is not assignable to param... Remove this comment to see the full error message
: d3.time.sundays(Math.min(weekStart, stop), Math.max(weekStart, stop));
},
@@ -2716,7 +2738,7 @@ CalHeatMap.prototype = {
* @param int|date range Number of months in the range, or a stop date
* @return array An array of months
*/
- getMonthDomain: function (d, range) {
+ getMonthDomain: function (d: $TSFixMe, range: $TSFixMe) {
'use strict';
var start = new Date(d.getFullYear(), d.getMonth());
@@ -2728,6 +2750,7 @@ CalHeatMap.prototype = {
stop = stop.setMonth(stop.getMonth() + range);
}
+ // @ts-expect-error TS(2345): Argument of type 'Date' is not assignable to param... Remove this comment to see the full error message
return d3.time.months(Math.min(start, stop), Math.max(start, stop));
},
@@ -2738,7 +2761,7 @@ CalHeatMap.prototype = {
* @param int|date range Number of minutes in the range, or a stop date
* @return array An array of hours
*/
- getYearDomain: function (d, range) {
+ getYearDomain: function (d: $TSFixMe, range: $TSFixMe) {
'use strict';
var start = new Date(d.getFullYear(), 0);
@@ -2749,6 +2772,7 @@ CalHeatMap.prototype = {
stop = new Date(d.getFullYear() + range, 0);
}
+ // @ts-expect-error TS(2345): Argument of type 'Date' is not assignable to param... Remove this comment to see the full error message
return d3.time.years(Math.min(start, stop), Math.max(start, stop));
},
@@ -2759,7 +2783,7 @@ CalHeatMap.prototype = {
* @param int|Date range Number of dates to get, or a stop date
* @return Array of dates
*/
- getDomain: function (date, range) {
+ getDomain: function (date: $TSFixMe, range: $TSFixMe) {
'use strict';
if (typeof date === 'number') {
@@ -2796,7 +2820,7 @@ CalHeatMap.prototype = {
},
/* jshint maxcomplexity: false */
- getSubDomain: function (date) {
+ getSubDomain: function (date: $TSFixMe) {
'use strict';
if (typeof date === 'number') {
@@ -2808,7 +2832,7 @@ CalHeatMap.prototype = {
/**
* @return int
*/
- var computeDaySubDomainSize = function (date, domain) {
+ var computeDaySubDomainSize = function (date: $TSFixMe, domain: $TSFixMe) {
switch (domain) {
case 'year':
return parent.getDayCountInYear(date);
@@ -2822,7 +2846,8 @@ CalHeatMap.prototype = {
/**
* @return int
*/
- var computeMinSubDomainSize = function (date, domain) {
+ // @ts-expect-error TS(7030): Not all code paths return a value.
+ var computeMinSubDomainSize = function (date: $TSFixMe, domain: $TSFixMe) {
switch (domain) {
case 'hour':
return 60;
@@ -2836,7 +2861,8 @@ CalHeatMap.prototype = {
/**
* @return int
*/
- var computeHourSubDomainSize = function (date, domain) {
+ // @ts-expect-error TS(7030): Not all code paths return a value.
+ var computeHourSubDomainSize = function (date: $TSFixMe, domain: $TSFixMe) {
switch (domain) {
case 'day':
return 24;
@@ -2850,7 +2876,7 @@ CalHeatMap.prototype = {
/**
* @return int
*/
- var computeWeekSubDomainSize = function (date, domain) {
+ var computeWeekSubDomainSize = function (date: $TSFixMe, domain: $TSFixMe) {
if (domain === 'month') {
var endOfMonth = new Date(date.getFullYear(), date.getMonth() + 1, 0);
var endWeekNb = parent.getWeekNumber(endOfMonth);
@@ -2905,7 +2931,7 @@ CalHeatMap.prototype = {
* @param int n
* @return Date The start date of the wanted domain
*/
- getNextDomain: function (n) {
+ getNextDomain: function (n: $TSFixMe) {
'use strict';
if (arguments.length === 0) {
@@ -2922,7 +2948,7 @@ CalHeatMap.prototype = {
* @param int n
* @return Date The start date of the wanted domain
*/
- getPreviousDomain: function (n) {
+ getPreviousDomain: function (n: $TSFixMe) {
'use strict';
if (arguments.length === 0) {
@@ -2953,12 +2979,12 @@ CalHeatMap.prototype = {
* - False if data are loaded asynchronously
*/
getDatas: function (
- source,
- startDate,
- endDate,
- callback,
- afterLoad,
- updateMode,
+ source: $TSFixMe,
+ startDate: $TSFixMe,
+ endDate: $TSFixMe,
+ callback: $TSFixMe,
+ afterLoad: $TSFixMe,
+ updateMode: $TSFixMe,
) {
'use strict';
@@ -2969,7 +2995,7 @@ CalHeatMap.prototype = {
if (arguments.length < 6) {
updateMode = this.APPEND_ON_UPDATE;
}
- var _callback = function (error, data) {
+ var _callback = function(this: $TSFixMe, error: $TSFixMe, data: $TSFixMe) {
if (afterLoad !== false) {
if (typeof afterLoad === 'function') {
data = afterLoad(data);
@@ -3060,12 +3086,12 @@ CalHeatMap.prototype = {
*
* @return void
*/
- parseDatas: function (data, updateMode, startDate, endDate) {
+ parseDatas: function (data: $TSFixMe, updateMode: $TSFixMe, startDate: $TSFixMe, endDate: $TSFixMe) {
'use strict';
if (updateMode === this.RESET_ALL_ON_UPDATE) {
- this._domains.forEach(function (key, value) {
- value.forEach(function (element, index, array) {
+ this._domains.forEach(function (key: $TSFixMe, value: $TSFixMe) {
+ value.forEach(function (element: $TSFixMe, index: $TSFixMe, array: $TSFixMe) {
array[index].v = null;
});
});
@@ -3073,12 +3099,13 @@ CalHeatMap.prototype = {
var temp = {};
- var extractTime = function (d) {
+ var extractTime = function (d: $TSFixMe) {
return d.t;
};
/*jshint forin:false */
for (var d in data) {
+ // @ts-expect-error TS(2362): The left-hand side of an arithmetic operation must... Remove this comment to see the full error message
var date = new Date(d * 1000);
var domainUnit = this.getDomain(date)[0].getTime();
// The current data belongs to a domain that was compressed
@@ -3093,6 +3120,7 @@ CalHeatMap.prototype = {
// Skip if data is not relevant to current domain
if (
+ // @ts-expect-error TS(2345): Argument of type 'string' is not assignable to par... Remove this comment to see the full error message
isNaN(d) ||
!data.hasOwnProperty(d) ||
!this._domains.has(domainUnit) ||
@@ -3104,9 +3132,11 @@ CalHeatMap.prototype = {
var subDomainsData = this._domains.get(domainUnit);
if (!temp.hasOwnProperty(domainUnit)) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
temp[domainUnit] = subDomainsData.map(extractTime);
}
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
var index = temp[domainUnit].indexOf(
this._domainType[this.options.subDomain].extractUnit(date),
);
@@ -3123,7 +3153,7 @@ CalHeatMap.prototype = {
}
},
- parseURI: function (str, startDate, endDate) {
+ parseURI: function (str: $TSFixMe, startDate: $TSFixMe, endDate: $TSFixMe) {
'use strict';
// Use a timestamp in seconds
@@ -3137,13 +3167,14 @@ CalHeatMap.prototype = {
return str;
},
- interpretCSV: function (data) {
+ interpretCSV: function (data: $TSFixMe) {
'use strict';
var d = {};
var keys = Object.keys(data[0]);
var i, total;
for (i = 0, total = data.length; i < total; i += 1) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
d[data[i][keys[0]]] = +data[i][keys[1]];
}
return d;
@@ -3230,7 +3261,7 @@ CalHeatMap.prototype = {
/**
* Shift the calendar forward
*/
- next: function (n) {
+ next: function (n: $TSFixMe) {
'use strict';
if (arguments.length === 0) {
@@ -3242,7 +3273,7 @@ CalHeatMap.prototype = {
/**
* Shift the calendar backward
*/
- previous: function (n) {
+ previous: function (n: $TSFixMe) {
'use strict';
if (arguments.length === 0) {
@@ -3262,7 +3293,7 @@ CalHeatMap.prototype = {
* @param bool reset Whether the wanted domain should be the first domain of the calendar
* @param bool True of the calendar was scrolled
*/
- jumpTo: function (date, reset) {
+ jumpTo: function (date: $TSFixMe, reset: $TSFixMe) {
'use strict';
if (arguments.length < 2) {
@@ -3306,7 +3337,7 @@ CalHeatMap.prototype = {
* @param boolean|function afterLoad Whether to execute afterLoad() on the data. Pass directly a function
* if you don't want to use the afterLoad() callback
*/
- update: function (dataSource, afterLoad, updateMode) {
+ update: function (dataSource: $TSFixMe, afterLoad: $TSFixMe, updateMode: $TSFixMe) {
'use strict';
if (arguments.length === 0) {
@@ -3415,7 +3446,7 @@ CalHeatMap.prototype = {
* @param array Array of dates to highlight
* @return bool True if dates were highlighted
*/
- highlight: function (args) {
+ highlight: function (args: $TSFixMe) {
'use strict';
if ((this.options.highlight = this.expandDateSetting(args)).length > 0) {
@@ -3434,7 +3465,7 @@ CalHeatMap.prototype = {
* @param function A callback function to trigger after destroying the calendar
* @return null
*/
- destroy: function (callback) {
+ destroy: function (callback: $TSFixMe) {
'use strict';
this.root
@@ -3479,6 +3510,7 @@ CalHeatMap.prototype = {
j <= total;
j += 1
) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
styles['.q' + j] = {};
}
@@ -3517,13 +3549,14 @@ CalHeatMap.prototype = {
'font-weight',
];
- var filterStyles = function (attribute, property, value) {
+ var filterStyles = function (attribute: $TSFixMe, property: $TSFixMe, value: $TSFixMe) {
if (whitelistStyles.indexOf(property) !== -1) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
styles[attribute][property] = value;
}
};
- var getElement = function (e) {
+ var getElement = function (e: $TSFixMe) {
return root.select(e)[0][0];
};
@@ -3573,7 +3606,9 @@ CalHeatMap.prototype = {
for (var style in styles) {
string += style + ' {\n';
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
for (var l in styles[style]) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
string += '\t' + l + ':' + styles[style][l] + ';\n';
}
string += '}\n';
@@ -3594,19 +3629,19 @@ CalHeatMap.prototype = {
/**
* Compute the position of a domain, relative to the calendar
*/
-var DomainPosition = function () {
+var DomainPosition = function(this: $TSFixMe) {
'use strict';
this.positions = d3.map();
};
-DomainPosition.prototype.getPosition = function (d) {
+DomainPosition.prototype.getPosition = function (d: $TSFixMe) {
'use strict';
return this.positions.get(d);
};
-DomainPosition.prototype.getPositionFromIndex = function (i) {
+DomainPosition.prototype.getPositionFromIndex = function (i: $TSFixMe) {
'use strict';
var domains = this.getKeys();
@@ -3620,16 +3655,16 @@ DomainPosition.prototype.getLast = function () {
return this.positions.get(domains[domains.length - 1]);
};
-DomainPosition.prototype.setPosition = function (d, dim) {
+DomainPosition.prototype.setPosition = function (d: $TSFixMe, dim: $TSFixMe) {
'use strict';
this.positions.set(d, dim);
};
-DomainPosition.prototype.shiftRightBy = function (exitingDomainDim) {
+DomainPosition.prototype.shiftRightBy = function (exitingDomainDim: $TSFixMe) {
'use strict';
- this.positions.forEach(function (key, value) {
+ this.positions.forEach(function(this: $TSFixMe, key: $TSFixMe, value: $TSFixMe) {
this.set(key, value - exitingDomainDim);
});
@@ -3637,10 +3672,10 @@ DomainPosition.prototype.shiftRightBy = function (exitingDomainDim) {
this.positions.remove(domains[0]);
};
-DomainPosition.prototype.shiftLeftBy = function (enteringDomainDim) {
+DomainPosition.prototype.shiftLeftBy = function (enteringDomainDim: $TSFixMe) {
'use strict';
- this.positions.forEach(function (key, value) {
+ this.positions.forEach(function(this: $TSFixMe, key: $TSFixMe, value: $TSFixMe) {
this.set(key, value + enteringDomainDim);
});
@@ -3651,7 +3686,7 @@ DomainPosition.prototype.shiftLeftBy = function (enteringDomainDim) {
DomainPosition.prototype.getKeys = function () {
'use strict';
- return this.positions.keys().sort(function (a, b) {
+ return this.positions.keys().sort(function (a: $TSFixMe, b: $TSFixMe) {
return parseInt(a, 10) - parseInt(b, 10);
});
};
@@ -3660,7 +3695,7 @@ DomainPosition.prototype.getKeys = function () {
// LEGEND //
// =========================================================================//
-var Legend = function (calendar) {
+var Legend = function(this: $TSFixMe, calendar: $TSFixMe) {
'use strict';
this.calendar = calendar;
@@ -3690,7 +3725,8 @@ Legend.prototype.remove = function () {
this.calendar.resize();
};
-Legend.prototype.redraw = function (width) {
+// @ts-expect-error TS(7030): Not all code paths return a value.
+Legend.prototype.redraw = function (width: $TSFixMe) {
'use strict';
if (!this.calendar.options.displayLegend) {
@@ -3734,11 +3770,11 @@ Legend.prototype.redraw = function (width) {
.enter()
.append('rect')
.call(legendCellLayout)
- .attr('class', function (d) {
+ .attr('class', function (d: $TSFixMe) {
return calendar.Legend.getClass(d, calendar.legendScale === null);
})
.attr('fill-opacity', 0)
- .call(function (selection) {
+ .call(function (selection: $TSFixMe) {
if (
calendar.legendScale !== null &&
options.legendColors !== null &&
@@ -3758,13 +3794,13 @@ Legend.prototype.redraw = function (width) {
legendItem
.transition()
- .delay(function (d, i) {
+ .delay(function (d: $TSFixMe, i: $TSFixMe) {
return (options.animationDuration * i) / 10;
})
.call(legendCellLayout)
.attr('fill-opacity', 1)
- .call(function (element) {
- element.attr('fill', function (d, i) {
+ .call(function (element: $TSFixMe) {
+ element.attr('fill', function (d: $TSFixMe, i: $TSFixMe) {
if (calendar.legendScale === null) {
return '';
}
@@ -3775,23 +3811,23 @@ Legend.prototype.redraw = function (width) {
return calendar.legendScale(options.legend[i - 1]);
});
- element.attr('class', function (d) {
+ element.attr('class', function (d: $TSFixMe) {
return calendar.Legend.getClass(d, calendar.legendScale === null);
});
});
- function legendCellLayout(selection) {
+ function legendCellLayout(selection: $TSFixMe) {
selection
.attr('width', options.legendCellSize)
.attr('height', options.legendCellSize)
.attr('rx', options.legendCellRadius)
.attr('ry', options.legendCellRadius)
- .attr('x', function (d, i) {
+ .attr('x', function (d: $TSFixMe, i: $TSFixMe) {
return i * (options.legendCellSize + options.legendCellPadding);
});
}
- legendItem.select('title').text(function (d, i) {
+ legendItem.select('title').text(function (d: $TSFixMe, i: $TSFixMe) {
if (i === 0) {
return calendar.formatStringWithObject(options.legendTitleFormat.lower, {
min: options.legend[i],
@@ -3811,7 +3847,7 @@ Legend.prototype.redraw = function (width) {
}
});
legendItem
- .on('mouseover', function (d) {
+ .on('mouseover', function(this: $TSFixMe, d: $TSFixMe) {
calendar.legendTip.show(d, this);
})
.on('mouseout', function () {
@@ -3884,7 +3920,7 @@ Legend.prototype.redraw = function (width) {
* @param string axis Width or height
* @return int height or width in pixels
*/
-Legend.prototype.getDim = function (axis) {
+Legend.prototype.getDim = function (axis: $TSFixMe) {
'use strict';
var isHorizontal = this.calendar.options.legendOrientation === 'horizontal';
@@ -3931,7 +3967,7 @@ Legend.prototype.buildColors = function () {
_legend[0] - (_legend[_legend.length - 1] - _legend[0]) / _legend.length,
);
}
- var colorScale;
+ var colorScale: $TSFixMe;
if (options.legendColors.hasOwnProperty('colorScale')) {
colorScale = options.legendColors.colorScale;
} else {
@@ -3942,7 +3978,7 @@ Legend.prototype.buildColors = function () {
.domain([d3.min(_legend), d3.max(_legend)]);
}
- var legendColors = _legend.map(function (element) {
+ var legendColors = _legend.map(function (element: $TSFixMe) {
return colorScale(element);
});
this.calendar.legendScale = d3.scale
@@ -3962,7 +3998,7 @@ Legend.prototype.buildColors = function () {
*
* @return string Classname according to the legend
*/
-Legend.prototype.getClass = function (n, withCssClass) {
+Legend.prototype.getClass = function (n: $TSFixMe, withCssClass: $TSFixMe) {
'use strict';
if (n === null || isNaN(n)) {
@@ -3998,7 +4034,7 @@ Legend.prototype.getClass = function (n, withCssClass) {
/**
* #source http://stackoverflow.com/a/383245/805649
*/
-function mergeRecursive(obj1, obj2) {
+function mergeRecursive(obj1: $TSFixMe, obj2: $TSFixMe) {
'use strict';
/*jshint forin:false */
@@ -4026,7 +4062,7 @@ function mergeRecursive(obj1, obj2) {
* @param array array the array to compare to
* @return bool true of the 2 arrays are equals
*/
-function arrayEquals(arrayA, arrayB) {
+function arrayEquals(arrayA: $TSFixMe, arrayB: $TSFixMe) {
'use strict';
// if the other array is a falsy value, return
diff --git a/superset-frontend/plugins/legacy-plugin-chart-chord/src/Chord.js b/superset-frontend/plugins/legacy-plugin-chart-chord/src/Chord.ts
similarity index 80%
rename from superset-frontend/plugins/legacy-plugin-chart-chord/src/Chord.js
rename to superset-frontend/plugins/legacy-plugin-chart-chord/src/Chord.ts
index 1d5ed45683..fa5284d19c 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-chord/src/Chord.js
+++ b/superset-frontend/plugins/legacy-plugin-chart-chord/src/Chord.ts
@@ -35,7 +35,7 @@ const propTypes = {
numberFormat: PropTypes.string,
};
-function Chord(element, props) {
+function Chord(element: $TSFixMe, props: $TSFixMe) {
const { data, width, height, numberFormat, colorScheme, sliceId } = props;
element.innerHTML = '';
@@ -49,7 +49,7 @@ function Chord(element, props) {
const outerRadius = Math.min(width, height) / 2 - 10;
const innerRadius = outerRadius - 24;
- let chord;
+ let chord: $TSFixMe;
const arc = d3.svg.arc().innerRadius(innerRadius).outerRadius(outerRadius);
@@ -81,30 +81,35 @@ function Chord(element, props) {
.enter()
.append('g')
.attr('class', 'group')
- .on('mouseover', (d, i) => {
- chord.classed('fade', p => p.source.index !== i && p.target.index !== i);
+ .on('mouseover', (d: $TSFixMe, i: $TSFixMe) => {
+ chord.classed(
+ 'fade',
+ (p: $TSFixMe) => p.source.index !== i && p.target.index !== i,
+ );
});
// Add a mouseover title.
- group.append('title').text((d, i) => `${nodes[i]}: ${f(d.value)}`);
+ group
+ .append('title')
+ .text((d: $TSFixMe, i: $TSFixMe) => `${nodes[i]}: ${f(d.value)}`);
// Add the group arc.
const groupPath = group
.append('path')
- .attr('id', (d, i) => `group${i}`)
+ .attr('id', (d: $TSFixMe, i: $TSFixMe) => `group${i}`)
.attr('d', arc)
- .style('fill', (d, i) => colorFn(nodes[i], sliceId));
+ .style('fill', (d: $TSFixMe, i: $TSFixMe) => colorFn(nodes[i], sliceId));
// Add a text label.
const groupText = group.append('text').attr('x', 6).attr('dy', 15);
groupText
.append('textPath')
- .attr('xlink:href', (d, i) => `#group${i}`)
- .text((d, i) => nodes[i]);
+ .attr('xlink:href', (d: $TSFixMe, i: $TSFixMe) => `#group${i}`)
+ .text((d: $TSFixMe, i: $TSFixMe) => nodes[i]);
// Remove the labels that don't fit. :(
groupText
- .filter(function filter(d, i) {
+ .filter(function filter(this: $TSFixMe, d: $TSFixMe, i: $TSFixMe) {
return (
groupPath[0][i].getTotalLength() / 2 - 16 < this.getComputedTextLength()
);
@@ -118,17 +123,17 @@ function Chord(element, props) {
.enter()
.append('path')
.attr('class', 'chord')
- .on('mouseover', d => {
- chord.classed('fade', p => p !== d);
+ .on('mouseover', (d: $TSFixMe) => {
+ chord.classed('fade', (p: $TSFixMe) => p !== d);
})
- .style('fill', d => colorFn(nodes[d.source.index], sliceId))
+ .style('fill', (d: $TSFixMe) => colorFn(nodes[d.source.index], sliceId))
.attr('d', path);
// Add an elaborate mouseover title for each chord.
chord
.append('title')
.text(
- d =>
+ (d: $TSFixMe) =>
`${nodes[d.source.index]} → ${nodes[d.target.index]}: ${f(
d.target.value,
)}\n${nodes[d.target.index]} → ${nodes[d.source.index]}: ${f(
diff --git a/superset-frontend/plugins/legacy-plugin-chart-chord/src/ReactChord.jsx b/superset-frontend/plugins/legacy-plugin-chart-chord/src/ReactChord.tsx
similarity index 96%
rename from superset-frontend/plugins/legacy-plugin-chart-chord/src/ReactChord.jsx
rename to superset-frontend/plugins/legacy-plugin-chart-chord/src/ReactChord.tsx
index d413a79537..e268ee87db 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-chord/src/ReactChord.jsx
+++ b/superset-frontend/plugins/legacy-plugin-chart-chord/src/ReactChord.tsx
@@ -22,7 +22,7 @@ import Component from './Chord';
const ReactComponent = reactify(Component);
-const Chord = ({ className, ...otherProps }) => (
+const Chord = ({ className, ...otherProps }: $TSFixMe) => (
<div className={className}>
<ReactComponent {...otherProps} />
</div>
diff --git a/superset-frontend/plugins/legacy-plugin-chart-chord/src/index.js b/superset-frontend/plugins/legacy-plugin-chart-chord/src/index.ts
similarity index 100%
rename from superset-frontend/plugins/legacy-plugin-chart-chord/src/index.js
rename to superset-frontend/plugins/legacy-plugin-chart-chord/src/index.ts
diff --git a/superset-frontend/plugins/legacy-plugin-chart-chord/src/transformProps.js b/superset-frontend/plugins/legacy-plugin-chart-chord/src/transformProps.ts
similarity index 94%
rename from superset-frontend/plugins/legacy-plugin-chart-chord/src/transformProps.js
rename to superset-frontend/plugins/legacy-plugin-chart-chord/src/transformProps.ts
index 7503ff4ea1..89dde01c71 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-chord/src/transformProps.js
+++ b/superset-frontend/plugins/legacy-plugin-chart-chord/src/transformProps.ts
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-export default function transformProps(chartProps) {
+export default function transformProps(chartProps: $TSFixMe) {
const { width, height, formData, queriesData } = chartProps;
const { yAxisFormat, colorScheme, sliceId } = formData;
diff --git a/superset-frontend/plugins/legacy-plugin-chart-country-map/src/CountryMap.js b/superset-frontend/plugins/legacy-plugin-chart-country-map/src/CountryMap.ts
similarity index 81%
rename from superset-frontend/plugins/legacy-plugin-chart-country-map/src/CountryMap.js
rename to superset-frontend/plugins/legacy-plugin-chart-country-map/src/CountryMap.ts
index b1cf5016dc..b41b7c2aec 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-country-map/src/CountryMap.js
+++ b/superset-frontend/plugins/legacy-plugin-chart-country-map/src/CountryMap.ts
@@ -45,7 +45,7 @@ const propTypes = {
const maps = {};
-function CountryMap(element, props) {
+function CountryMap(element: $TSFixMe, props: $TSFixMe) {
const {
data,
width,
@@ -59,18 +59,22 @@ function CountryMap(element, props) {
const container = element;
const format = getNumberFormatter(numberFormat);
+ // @ts-expect-error TS(2532): Object is possibly 'undefined'.
const linearColorScale = getSequentialSchemeRegistry()
.get(linearColorScheme)
+ // @ts-expect-error TS(2345): Argument of type '[string, string] | [undefined, u... Remove this comment to see the full error message
.createLinearScale(d3Extent(data, v => v.metric));
const colorScale = CategoricalColorNamespace.getScale(colorScheme);
const colorMap = {};
- data.forEach(d => {
+ data.forEach((d: $TSFixMe) => {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
colorMap[d.country_id] = colorScheme
? colorScale(d.country_id, sliceId)
: linearColorScale(d.metric);
});
- const colorFn = d => colorMap[d.properties.ISO] || 'none';
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
+ const colorFn = (d: $TSFixMe) => colorMap[d.properties.ISO] || 'none';
const path = d3.geo.path();
const div = d3.select(container);
@@ -100,9 +104,9 @@ function CountryMap(element, props) {
.classed('result-text', true)
.attr('dy', '1em');
- let centered;
+ let centered: $TSFixMe;
- const clicked = function clicked(d) {
+ const clicked = function clicked(d: $TSFixMe) {
const hasCenter = d && centered !== d;
let x;
let y;
@@ -150,7 +154,7 @@ function CountryMap(element, props) {
backgroundRect.on('click', clicked);
const selectAndDisplayNameOfRegion = function selectAndDisplayNameOfRegion(
- feature,
+ feature: $TSFixMe,
) {
let name = '';
if (feature && feature.properties) {
@@ -163,13 +167,13 @@ function CountryMap(element, props) {
bigText.text(name);
};
- const updateMetrics = function updateMetrics(region) {
+ const updateMetrics = function updateMetrics(region: $TSFixMe) {
if (region.length > 0) {
resultText.text(format(region[0].metric));
}
};
- const mouseenter = function mouseenter(d) {
+ const mouseenter = function mouseenter(this: $TSFixMe, d: $TSFixMe) {
// Darken color
let c = colorFn(d);
if (c !== 'none') {
@@ -178,18 +182,18 @@ function CountryMap(element, props) {
d3.select(this).style('fill', c);
selectAndDisplayNameOfRegion(d);
const result = data.filter(
- region => region.country_id === d.properties.ISO,
+ (region: $TSFixMe) => region.country_id === d.properties.ISO,
);
updateMetrics(result);
};
- const mouseout = function mouseout() {
+ const mouseout = function mouseout(this: $TSFixMe) {
d3.select(this).style('fill', colorFn);
bigText.text('');
resultText.text('');
};
- function drawMap(mapData) {
+ function drawMap(mapData: $TSFixMe) {
const { features } = mapData;
const center = d3.geo.centroid(mapData);
const scale = 100;
@@ -229,12 +233,14 @@ function CountryMap(element, props) {
.on('click', clicked);
}
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
const map = maps[country];
if (map) {
drawMap(map);
} else {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
const url = countries[country];
- d3.json(url, (error, mapData) => {
+ d3.json(url, (error: $TSFixMe, mapData: $TSFixMe) => {
if (error) {
const countryName =
countryOptions.find(x => x[0] === country)?.[1] || country;
@@ -242,6 +248,7 @@ function CountryMap(element, props) {
`<div class="alert alert-danger">Could not load map data for ${countryName}</div>`,
);
} else {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
maps[country] = mapData;
drawMap(mapData);
}
diff --git a/superset-frontend/plugins/legacy-plugin-chart-country-map/src/ReactCountryMap.jsx b/superset-frontend/plugins/legacy-plugin-chart-country-map/src/ReactCountryMap.tsx
similarity index 97%
rename from superset-frontend/plugins/legacy-plugin-chart-country-map/src/ReactCountryMap.jsx
rename to superset-frontend/plugins/legacy-plugin-chart-country-map/src/ReactCountryMap.tsx
index b857b36040..70f6d33649 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-country-map/src/ReactCountryMap.jsx
+++ b/superset-frontend/plugins/legacy-plugin-chart-country-map/src/ReactCountryMap.tsx
@@ -21,7 +21,7 @@ import Component from './CountryMap';
const ReactComponent = reactify(Component);
-const CountryMap = ({ className, ...otherProps }) => (
+const CountryMap = ({ className, ...otherProps }: $TSFixMe) => (
<div className={className}>
<ReactComponent {...otherProps} />
</div>
diff --git a/superset-frontend/plugins/legacy-plugin-chart-country-map/src/index.js b/superset-frontend/plugins/legacy-plugin-chart-country-map/src/index.ts
similarity index 100%
rename from superset-frontend/plugins/legacy-plugin-chart-country-map/src/index.js
rename to superset-frontend/plugins/legacy-plugin-chart-country-map/src/index.ts
diff --git a/superset-frontend/plugins/legacy-plugin-chart-country-map/src/transformProps.js b/superset-frontend/plugins/legacy-plugin-chart-country-map/src/transformProps.ts
similarity index 95%
rename from superset-frontend/plugins/legacy-plugin-chart-country-map/src/transformProps.js
rename to superset-frontend/plugins/legacy-plugin-chart-country-map/src/transformProps.ts
index 8789c3d2f3..7d86499a8e 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-country-map/src/transformProps.js
+++ b/superset-frontend/plugins/legacy-plugin-chart-country-map/src/transformProps.ts
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-export default function transformProps(chartProps) {
+export default function transformProps(chartProps: $TSFixMe) {
const { width, height, formData, queriesData } = chartProps;
const {
linearColorScheme,
diff --git a/superset-frontend/plugins/legacy-plugin-chart-horizon/src/HorizonChart.jsx b/superset-frontend/plugins/legacy-plugin-chart-horizon/src/HorizonChart.tsx
similarity index 64%
rename from superset-frontend/plugins/legacy-plugin-chart-horizon/src/HorizonChart.jsx
rename to superset-frontend/plugins/legacy-plugin-chart-horizon/src/HorizonChart.tsx
index 05b4b6e9aa..fa67fa0ab4 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-horizon/src/HorizonChart.jsx
+++ b/superset-frontend/plugins/legacy-plugin-chart-horizon/src/HorizonChart.tsx
@@ -83,24 +83,35 @@ const StyledDiv = styled.div`
class HorizonChart extends PureComponent {
render() {
const {
+ // @ts-expect-error TS(2339): Property 'className' does not exist on type 'Reado... Remove this comment to see the full error message
className,
+ // @ts-expect-error TS(2339): Property 'width' does not exist on type 'Readonly<... Remove this comment to see the full error message
width,
+ // @ts-expect-error TS(2339): Property 'height' does not exist on type 'Readonly... Remove this comment to see the full error message
height,
+ // @ts-expect-error TS(2339): Property 'data' does not exist on type 'Readonly<{... Remove this comment to see the full error message
data,
+ // @ts-expect-error TS(2339): Property 'seriesHeight' does not exist on type 'Re... Remove this comment to see the full error message
seriesHeight,
+ // @ts-expect-error TS(2339): Property 'bands' does not exist on type 'Readonly<... Remove this comment to see the full error message
bands,
+ // @ts-expect-error TS(2339): Property 'colors' does not exist on type 'Readonly... Remove this comment to see the full error message
colors,
+ // @ts-expect-error TS(2339): Property 'colorScale' does not exist on type 'Read... Remove this comment to see the full error message
colorScale,
+ // @ts-expect-error TS(2339): Property 'mode' does not exist on type 'Readonly<{... Remove this comment to see the full error message
mode,
+ // @ts-expect-error TS(2339): Property 'offsetX' does not exist on type 'Readonl... Remove this comment to see the full error message
offsetX,
} = this.props;
- let yDomain;
+ let yDomain: $TSFixMe;
if (colorScale === 'overall') {
const allValues = data.reduce(
- (acc, current) => acc.concat(current.values),
+ (acc: $TSFixMe, current: $TSFixMe) => acc.concat(current.values),
[],
);
+ // @ts-expect-error TS(2571): Object is of type 'unknown'.
yDomain = d3Extent(allValues, d => d.y);
}
@@ -110,9 +121,10 @@ class HorizonChart extends PureComponent {
className={`superset-legacy-chart-horizon ${className}`}
style={{ height }}
>
- {data.map(row => (
+ {data.map((row: $TSFixMe) => (
<HorizonRow
key={row.key}
+ // @ts-expect-error TS(2769): No overload matches this call.
width={width}
height={seriesHeight}
title={ensureIsArray(row.key).join(', ')}
@@ -131,7 +143,9 @@ class HorizonChart extends PureComponent {
}
}
+// @ts-expect-error TS(2339): Property 'propTypes' does not exist on type 'typeo... Remove this comment to see the full error message
HorizonChart.propTypes = propTypes;
+// @ts-expect-error TS(2339): Property 'defaultProps' does not exist on type 'ty... Remove this comment to see the full error message
HorizonChart.defaultProps = defaultProps;
export default HorizonChart;
diff --git a/superset-frontend/plugins/legacy-plugin-chart-horizon/src/HorizonRow.jsx b/superset-frontend/plugins/legacy-plugin-chart-horizon/src/HorizonRow.tsx
similarity index 73%
rename from superset-frontend/plugins/legacy-plugin-chart-horizon/src/HorizonRow.jsx
rename to superset-frontend/plugins/legacy-plugin-chart-horizon/src/HorizonRow.tsx
index b043abd435..482ca5d179 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-horizon/src/HorizonRow.jsx
+++ b/superset-frontend/plugins/legacy-plugin-chart-horizon/src/HorizonRow.tsx
@@ -67,6 +67,8 @@ const defaultProps = {
};
class HorizonRow extends PureComponent {
+ canvas: $TSFixMe;
+
componentDidMount() {
this.drawChart();
}
@@ -82,20 +84,32 @@ class HorizonRow extends PureComponent {
drawChart() {
if (this.canvas) {
const {
+ // @ts-expect-error TS(2339): Property 'data' does not exist on type 'Readonly<{... Remove this comment to see the full error message
data: rawData,
+ // @ts-expect-error TS(2339): Property 'yDomain' does not exist on type 'Readonl... Remove this comment to see the full error message
yDomain,
+ // @ts-expect-error TS(2339): Property 'width' does not exist on type 'Readonly<... Remove this comment to see the full error message
width,
+ // @ts-expect-error TS(2339): Property 'height' does not exist on type 'Readonly... Remove this comment to see the full error message
height,
+ // @ts-expect-error TS(2339): Property 'bands' does not exist on type 'Readonly<... Remove this comment to see the full error message
bands,
+ // @ts-expect-error TS(2339): Property 'colors' does not exist on type 'Readonly... Remove this comment to see the full error message
colors,
+ // @ts-expect-error TS(2339): Property 'colorScale' does not exist on type 'Read... Remove this comment to see the full error message
colorScale,
+ // @ts-expect-error TS(2339): Property 'offsetX' does not exist on type 'Readonl... Remove this comment to see the full error message
offsetX,
+ // @ts-expect-error TS(2339): Property 'mode' does not exist on type 'Readonly<{... Remove this comment to see the full error message
mode,
} = this.props;
const data =
colorScale === 'change'
- ? rawData.map(d => ({ ...d, y: d.y - rawData[0].y }))
+ ? rawData.map((d: $TSFixMe) => ({
+ ...d,
+ y: d.y - rawData[0].y,
+ }))
: rawData;
const context = this.canvas.getContext('2d');
@@ -118,6 +132,7 @@ class HorizonRow extends PureComponent {
}
// Create y-scale
+ // @ts-expect-error TS(2571): Object is of type 'unknown'.
const [min, max] = yDomain || d3Extent(data, d => d.y);
const y = scaleLinear()
.domain([0, Math.max(-min, max)])
@@ -148,6 +163,7 @@ class HorizonRow extends PureComponent {
offsetX + i * step,
y(value),
step + 1,
+ // @ts-expect-error TS(2532): Object is possibly 'undefined'.
y(0) - y(value),
);
}
@@ -179,6 +195,7 @@ class HorizonRow extends PureComponent {
offsetX + ii * step,
y(-value),
step + 1,
+ // @ts-expect-error TS(2532): Object is possibly 'undefined'.
y(0) - y(-value),
);
}
@@ -188,6 +205,7 @@ class HorizonRow extends PureComponent {
}
render() {
+ // @ts-expect-error TS(2339): Property 'className' does not exist on type 'Reado... Remove this comment to see the full error message
const { className, title, width, height } = this.props;
return (
@@ -205,7 +223,9 @@ class HorizonRow extends PureComponent {
}
}
+// @ts-expect-error TS(2339): Property 'propTypes' does not exist on type 'typeo... Remove this comment to see the full error message
HorizonRow.propTypes = propTypes;
+// @ts-expect-error TS(2339): Property 'defaultProps' does not exist on type 'ty... Remove this comment to see the full error message
HorizonRow.defaultProps = defaultProps;
export default HorizonRow;
diff --git a/superset-frontend/plugins/legacy-plugin-chart-horizon/src/index.js b/superset-frontend/plugins/legacy-plugin-chart-horizon/src/index.ts
similarity index 100%
rename from superset-frontend/plugins/legacy-plugin-chart-horizon/src/index.js
rename to superset-frontend/plugins/legacy-plugin-chart-horizon/src/index.ts
diff --git a/superset-frontend/plugins/legacy-plugin-chart-horizon/src/transformProps.js b/superset-frontend/plugins/legacy-plugin-chart-horizon/src/transformProps.ts
similarity index 94%
rename from superset-frontend/plugins/legacy-plugin-chart-horizon/src/transformProps.js
rename to superset-frontend/plugins/legacy-plugin-chart-horizon/src/transformProps.ts
index 9fba63a88a..b4f586ede5 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-horizon/src/transformProps.js
+++ b/superset-frontend/plugins/legacy-plugin-chart-horizon/src/transformProps.ts
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-export default function transformProps(chartProps) {
+export default function transformProps(chartProps: $TSFixMe) {
const { height, width, formData, queriesData } = chartProps;
const { horizonColorScale, seriesHeight } = formData;
diff --git a/superset-frontend/plugins/legacy-plugin-chart-map-box/src/MapBox.jsx b/superset-frontend/plugins/legacy-plugin-chart-map-box/src/MapBox.tsx
similarity index 64%
rename from superset-frontend/plugins/legacy-plugin-chart-map-box/src/MapBox.jsx
rename to superset-frontend/plugins/legacy-plugin-chart-map-box/src/MapBox.tsx
index 943cf7174b..cc156609c2 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-map-box/src/MapBox.jsx
+++ b/superset-frontend/plugins/legacy-plugin-chart-map-box/src/MapBox.tsx
@@ -56,9 +56,10 @@ const defaultProps = {
};
class MapBox extends Component {
- constructor(props) {
+ constructor(props: $TSFixMe) {
super(props);
+ // @ts-expect-error TS(2339): Property 'width' does not exist on type 'Readonly<... Remove this comment to see the full error message
const { width, height, bounds } = this.props;
// Get a viewport that fits the given bounds, which all marks to be clustered.
// Derive lat, lon and zoom from this viewport. This is only done on initial
@@ -79,28 +80,43 @@ class MapBox extends Component {
this.handleViewportChange = this.handleViewportChange.bind(this);
}
- handleViewportChange(viewport) {
+ handleViewportChange(viewport: $TSFixMe) {
this.setState({ viewport });
+ // @ts-expect-error TS(2339): Property 'onViewportChange' does not exist on type... Remove this comment to see the full error message
const { onViewportChange } = this.props;
onViewportChange(viewport);
}
render() {
const {
+ // @ts-expect-error TS(2339): Property 'width' does not exist on type 'Readonly<... Remove this comment to see the full error message
width,
+ // @ts-expect-error TS(2339): Property 'height' does not exist on type 'Readonly... Remove this comment to see the full error message
height,
+ // @ts-expect-error TS(2339): Property 'aggregatorName' does not exist on type '... Remove this comment to see the full error message
aggregatorName,
+ // @ts-expect-error TS(2339): Property 'clusterer' does not exist on type 'Reado... Remove this comment to see the full error message
clusterer,
+ // @ts-expect-error TS(2339): Property 'globalOpacity' does not exist on type 'R... Remove this comment to see the full error message
globalOpacity,
+ // @ts-expect-error TS(2339): Property 'mapStyle' does not exist on type 'Readon... Remove this comment to see the full error message
mapStyle,
+ // @ts-expect-error TS(2339): Property 'mapboxApiKey' does not exist on type 'Re... Remove this comment to see the full error message
mapboxApiKey,
+ // @ts-expect-error TS(2339): Property 'pointRadius' does not exist on type 'Rea... Remove this comment to see the full error message
pointRadius,
+ // @ts-expect-error TS(2339): Property 'pointRadiusUnit' does not exist on type ... Remove this comment to see the full error message
pointRadiusUnit,
+ // @ts-expect-error TS(2339): Property 'renderWhileDragging' does not exist on t... Remove this comment to see the full error message
renderWhileDragging,
+ // @ts-expect-error TS(2339): Property 'rgb' does not exist on type 'Readonly<{}... Remove this comment to see the full error message
rgb,
+ // @ts-expect-error TS(2339): Property 'hasCustomMetric' does not exist on type ... Remove this comment to see the full error message
hasCustomMetric,
+ // @ts-expect-error TS(2339): Property 'bounds' does not exist on type 'Readonly... Remove this comment to see the full error message
bounds,
} = this.props;
+ // @ts-expect-error TS(2339): Property 'viewport' does not exist on type 'Readon... Remove this comment to see the full error message
const { viewport } = this.state;
const isDragging =
viewport.isDragging === undefined ? false : viewport.isDragging;
@@ -140,7 +156,7 @@ class MapBox extends Component {
compositeOperation="screen"
renderWhileDragging={renderWhileDragging}
aggregation={hasCustomMetric ? aggregatorName : null}
- lngLatAccessor={location => {
+ lngLatAccessor={(location: $TSFixMe) => {
const { coordinates } = location.geometry;
return [coordinates[0], coordinates[1]];
@@ -151,7 +167,9 @@ class MapBox extends Component {
}
}
+// @ts-expect-error TS(2339): Property 'propTypes' does not exist on type 'typeo... Remove this comment to see the full error message
MapBox.propTypes = propTypes;
+// @ts-expect-error TS(2339): Property 'defaultProps' does not exist on type 'ty... Remove this comment to see the full error message
MapBox.defaultProps = defaultProps;
export default MapBox;
diff --git a/superset-frontend/plugins/legacy-plugin-chart-map-box/src/ScatterPlotGlowOverlay.jsx b/superset-frontend/plugins/legacy-plugin-chart-map-box/src/ScatterPlotGlowOverlay.tsx
similarity index 75%
rename from superset-frontend/plugins/legacy-plugin-chart-map-box/src/ScatterPlotGlowOverlay.jsx
rename to superset-frontend/plugins/legacy-plugin-chart-map-box/src/ScatterPlotGlowOverlay.tsx
index 011c91ed9c..0025f12285 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-map-box/src/ScatterPlotGlowOverlay.jsx
+++ b/superset-frontend/plugins/legacy-plugin-chart-map-box/src/ScatterPlotGlowOverlay.tsx
@@ -43,11 +43,11 @@ const defaultProps = {
// Same as browser default.
compositeOperation: 'source-over',
dotRadius: 4,
- lngLatAccessor: location => [location[0], location[1]],
+ lngLatAccessor: (location: $TSFixMe) => [location[0], location[1]],
renderWhileDragging: true,
};
-const computeClusterLabel = (properties, aggregation) => {
+const computeClusterLabel = (properties: $TSFixMe, aggregation: $TSFixMe) => {
const count = properties.point_count;
if (!aggregation) {
return count;
@@ -74,18 +74,23 @@ const computeClusterLabel = (properties, aggregation) => {
};
class ScatterPlotGlowOverlay extends PureComponent {
- constructor(props) {
+ constructor(props: $TSFixMe) {
super(props);
this.redraw = this.redraw.bind(this);
}
- drawText(ctx, pixel, options = {}) {
+ drawText(ctx: $TSFixMe, pixel: $TSFixMe, options = {}) {
const IS_DARK_THRESHOLD = 110;
const {
+ // @ts-expect-error TS(2339): Property 'fontHeight' does not exist on type '{}'.
fontHeight = 0,
+ // @ts-expect-error TS(2339): Property 'label' does not exist on type '{}'.
label = '',
+ // @ts-expect-error TS(2339): Property 'radius' does not exist on type '{}'.
radius = 0,
+ // @ts-expect-error TS(2339): Property 'rgb' does not exist on type '{}'.
rgb = [0, 0, 0],
+ // @ts-expect-error TS(2339): Property 'shadow' does not exist on type '{}'.
shadow = false,
} = options;
const maxWidth = radius * 1.8;
@@ -107,6 +112,7 @@ class ScatterPlotGlowOverlay extends PureComponent {
ctx.font = `${scale * maxWidth}px sans-serif`;
}
+ // @ts-expect-error TS(2339): Property 'compositeOperation' does not exist on ty... Remove this comment to see the full error message
const { compositeOperation } = this.props;
ctx.fillText(label, pixel[0], pixel[1]);
@@ -116,23 +122,32 @@ class ScatterPlotGlowOverlay extends PureComponent {
}
// Modified: https://github.com/uber/react-map-gl/blob/master/overlays/scatterplot.react.js
- redraw({ width, height, ctx, isDragging, project }) {
+ redraw({ width, height, ctx, isDragging, project }: $TSFixMe) {
const {
+ // @ts-expect-error TS(2339): Property 'aggregation' does not exist on type 'Rea... Remove this comment to see the full error message
aggregation,
+ // @ts-expect-error TS(2339): Property 'compositeOperation' does not exist on ty... Remove this comment to see the full error message
compositeOperation,
+ // @ts-expect-error TS(2339): Property 'dotRadius' does not exist on type 'Reado... Remove this comment to see the full error message
dotRadius,
+ // @ts-expect-error TS(2339): Property 'lngLatAccessor' does not exist on type '... Remove this comment to see the full error message
lngLatAccessor,
+ // @ts-expect-error TS(2339): Property 'locations' does not exist on type 'Reado... Remove this comment to see the full error message
locations,
+ // @ts-expect-error TS(2339): Property 'pointRadiusUnit' does not exist on type ... Remove this comment to see the full error message
pointRadiusUnit,
+ // @ts-expect-error TS(2339): Property 'renderWhileDragging' does not exist on t... Remove this comment to see the full error message
renderWhileDragging,
+ // @ts-expect-error TS(2339): Property 'rgb' does not exist on type 'Readonly<{}... Remove this comment to see the full error message
rgb,
+ // @ts-expect-error TS(2339): Property 'zoom' does not exist on type 'Readonly<{... Remove this comment to see the full error message
zoom,
} = this.props;
const radius = dotRadius;
- const clusterLabelMap = [];
+ const clusterLabelMap: $TSFixMe = [];
- locations.forEach((location, i) => {
+ locations.forEach((location: $TSFixMe, i: $TSFixMe) => {
if (location.properties.cluster) {
clusterLabelMap[i] = computeClusterLabel(
location.properties,
@@ -141,13 +156,18 @@ class ScatterPlotGlowOverlay extends PureComponent {
}
}, this);
+ // @ts-expect-error TS(7006): Parameter 'v' implicitly has an 'any' type.
const maxLabel = Math.max(...clusterLabelMap.filter(v => !Number.isNaN(v)));
ctx.clearRect(0, 0, width, height);
ctx.globalCompositeOperation = compositeOperation;
if ((renderWhileDragging || !isDragging) && locations) {
- locations.forEach(function _forEach(location, i) {
+ locations.forEach(function _forEach(
+ this: $TSFixMe,
+ location: $TSFixMe,
+ i: $TSFixMe,
+ ) {
const pixel = project(lngLatAccessor(location));
const pixelRounded = [
roundDecimal(pixel[0], 1),
@@ -274,7 +294,9 @@ class ScatterPlotGlowOverlay extends PureComponent {
}
}
+// @ts-expect-error TS(2339): Property 'propTypes' does not exist on type 'typeo... Remove this comment to see the full error message
ScatterPlotGlowOverlay.propTypes = propTypes;
+// @ts-expect-error TS(2339): Property 'defaultProps' does not exist on type 'ty... Remove this comment to see the full error message
ScatterPlotGlowOverlay.defaultProps = defaultProps;
export default ScatterPlotGlowOverlay;
diff --git a/superset-frontend/plugins/legacy-plugin-chart-map-box/src/index.js b/superset-frontend/plugins/legacy-plugin-chart-map-box/src/index.ts
similarity index 86%
rename from superset-frontend/plugins/legacy-plugin-chart-map-box/src/index.js
rename to superset-frontend/plugins/legacy-plugin-chart-map-box/src/index.ts
index f422efafc8..1d867528ac 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-map-box/src/index.js
+++ b/superset-frontend/plugins/legacy-plugin-chart-map-box/src/index.ts
@@ -27,7 +27,9 @@ const metadata = new ChartMetadata({
credits: ['https://www.mapbox.com/mapbox-gl-js/api/'],
description: '',
exampleGallery: [
+ // @ts-expect-error TS(2322): Type '{ url: any; description: string; }' is not a... Remove this comment to see the full error message
{ url: example1, description: t('Light mode') },
+ // @ts-expect-error TS(2322): Type '{ url: any; description: string; }' is not a... Remove this comment to see the full error message
{ url: example2, description: t('Dark mode') },
],
name: t('MapBox'),
diff --git a/superset-frontend/plugins/legacy-plugin-chart-map-box/src/transformProps.js b/superset-frontend/plugins/legacy-plugin-chart-map-box/src/transformProps.ts
similarity index 78%
rename from superset-frontend/plugins/legacy-plugin-chart-map-box/src/transformProps.js
rename to superset-frontend/plugins/legacy-plugin-chart-map-box/src/transformProps.ts
index de2da2a735..6e2e757a56 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-map-box/src/transformProps.js
+++ b/superset-frontend/plugins/legacy-plugin-chart-map-box/src/transformProps.ts
@@ -16,12 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
+// @ts-expect-error TS(7016): Could not find a declaration file for module 'supe... Remove this comment to see the full error message
import Supercluster from 'supercluster';
import { DEFAULT_POINT_RADIUS, DEFAULT_MAX_ZOOM } from './MapBox';
const NOOP = () => {};
-export default function transformProps(chartProps) {
+export default function transformProps(chartProps: $TSFixMe) {
const { width, height, formData, hooks, queriesData } = chartProps;
const { onError = NOOP, setControlValue = NOOP } = hooks;
const { bounds, geoJSON, hasCustomMetric, mapboxApiKey } =
@@ -50,19 +51,22 @@ export default function transformProps(chartProps) {
radius: clusteringRadius,
};
if (hasCustomMetric) {
+ // @ts-expect-error TS(2339): Property 'initial' does not exist on type '{ maxZo... Remove this comment to see the full error message
opts.initial = () => ({
sum: 0,
squaredSum: 0,
min: Infinity,
max: -Infinity,
});
- opts.map = prop => ({
+ // @ts-expect-error TS(2339): Property 'map' does not exist on type '{ maxZoom: ... Remove this comment to see the full error message
+ opts.map = (prop: $TSFixMe) => ({
sum: prop.metric,
squaredSum: prop.metric ** 2,
min: prop.metric,
max: prop.metric,
});
- opts.reduce = (accu, prop) => {
+ // @ts-expect-error TS(2339): Property 'reduce' does not exist on type '{ maxZoo... Remove this comment to see the full error message
+ opts.reduce = (accu: $TSFixMe, prop: $TSFixMe) => {
// Temporarily disable param-reassignment linting to work with supercluster's api
/* eslint-disable no-param-reassign */
accu.sum += prop.sum;
@@ -85,7 +89,7 @@ export default function transformProps(chartProps) {
hasCustomMetric,
mapboxApiKey,
mapStyle: mapboxStyle,
- onViewportChange({ latitude, longitude, zoom }) {
+ onViewportChange({ latitude, longitude, zoom }: $TSFixMe) {
setControlValue('viewport_longitude', longitude);
setControlValue('viewport_latitude', latitude);
setControlValue('viewport_zoom', zoom);
diff --git a/superset-frontend/plugins/legacy-plugin-chart-map-box/src/utils/geo.js b/superset-frontend/plugins/legacy-plugin-chart-map-box/src/utils/geo.ts
similarity index 92%
rename from superset-frontend/plugins/legacy-plugin-chart-map-box/src/utils/geo.js
rename to superset-frontend/plugins/legacy-plugin-chart-map-box/src/utils/geo.ts
index d2e48a65f6..063b0e8f5b 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-map-box/src/utils/geo.js
+++ b/superset-frontend/plugins/legacy-plugin-chart-map-box/src/utils/geo.ts
@@ -22,7 +22,11 @@ import roundDecimal from './roundDecimal';
export const EARTH_CIRCUMFERENCE_KM = 40075.16;
export const MILES_PER_KM = 1.60934;
-export function kmToPixels(kilometers, latitude, zoomLevel) {
+export function kmToPixels(
+ kilometers: $TSFixMe,
+ latitude: $TSFixMe,
+ zoomLevel: $TSFixMe,
+) {
// Algorithm from: http://wiki.openstreetmap.org/wiki/Zoom_levels
const latitudeRad = latitude * (Math.PI / 180);
// Seems like the zoomLevel is off by one
diff --git a/superset-frontend/plugins/legacy-plugin-chart-map-box/src/utils/luminanceFromRGB.js b/superset-frontend/plugins/legacy-plugin-chart-map-box/src/utils/luminanceFromRGB.ts
similarity index 92%
rename from superset-frontend/plugins/legacy-plugin-chart-map-box/src/utils/luminanceFromRGB.js
rename to superset-frontend/plugins/legacy-plugin-chart-map-box/src/utils/luminanceFromRGB.ts
index 545d6b04ec..30ea657912 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-map-box/src/utils/luminanceFromRGB.js
+++ b/superset-frontend/plugins/legacy-plugin-chart-map-box/src/utils/luminanceFromRGB.ts
@@ -21,7 +21,11 @@ export const LUMINANCE_RED_WEIGHT = 0.2126;
export const LUMINANCE_GREEN_WEIGHT = 0.7152;
export const LUMINANCE_BLUE_WEIGHT = 0.0722;
-export default function luminanceFromRGB(r, g, b) {
+export default function luminanceFromRGB(
+ r: $TSFixMe,
+ g: $TSFixMe,
+ b: $TSFixMe,
+) {
// Formula: https://en.wikipedia.org/wiki/Relative_luminance
return (
LUMINANCE_RED_WEIGHT * r +
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 92%
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..baab429e31 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,7 +17,7 @@
* under the License.
*/
-export default function roundDecimal(number, precision) {
+export default function roundDecimal(number: $TSFixMe, precision: $TSFixMe) {
let roundedNumber;
let p = precision;
if (precision) {
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 94%
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
index 384eeb9412..4b0bb278a5 100644
--- 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
@@ -23,6 +23,7 @@ describe('roundDecimal', () => {
it('rounding method to limit the number of decimal digits', () => {
expect(roundDecimal(1.139, 2)).toBe(1.14);
expect(roundDecimal(1.13929, 3)).toBe(1.139);
+ // @ts-expect-error TS(2554): Expected 2 arguments, but got 1.
expect(roundDecimal(1.13929)).toBe(1);
});
});
diff --git a/superset-frontend/plugins/legacy-plugin-chart-paired-t-test/src/PairedTTest.jsx b/superset-frontend/plugins/legacy-plugin-chart-paired-t-test/src/PairedTTest.tsx
similarity index 86%
rename from superset-frontend/plugins/legacy-plugin-chart-paired-t-test/src/PairedTTest.jsx
rename to superset-frontend/plugins/legacy-plugin-chart-paired-t-test/src/PairedTTest.tsx
index f15a85f447..3a83a32197 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-paired-t-test/src/PairedTTest.jsx
+++ b/superset-frontend/plugins/legacy-plugin-chart-paired-t-test/src/PairedTTest.tsx
@@ -117,6 +117,7 @@ const StyledDiv = styled.div`
class PairedTTest extends PureComponent {
render() {
+ // @ts-expect-error TS(2339): Property 'className' does not exist on type 'Reado... Remove this comment to see the full error message
const { className, metrics, groups, data, alpha, pValPrec, liftValPrec } =
this.props;
@@ -125,9 +126,10 @@ class PairedTTest extends PureComponent {
<div className={`superset-legacy-chart-paired-t-test ${className}`}>
<div className="paired-ttest-table">
<div className="scrollbar-content">
- {metrics.map((metric, i) => (
+ {metrics.map((metric: $TSFixMe, i: $TSFixMe) => (
<TTestTable
key={i}
+ // @ts-expect-error TS(2322): Type '{ key: any; metric: any; groups: any; data: ... Remove this comment to see the full error message
metric={metric}
groups={groups}
data={data[metric]}
@@ -144,7 +146,9 @@ class PairedTTest extends PureComponent {
}
}
+// @ts-expect-error TS(2339): Property 'propTypes' does not exist on type 'typeo... Remove this comment to see the full error message
PairedTTest.propTypes = propTypes;
+// @ts-expect-error TS(2339): Property 'defaultProps' does not exist on type 'ty... Remove this comment to see the full error message
PairedTTest.defaultProps = defaultProps;
export default PairedTTest;
diff --git a/superset-frontend/plugins/legacy-plugin-chart-paired-t-test/src/TTestTable.jsx b/superset-frontend/plugins/legacy-plugin-chart-paired-t-test/src/TTestTable.tsx
similarity index 74%
rename from superset-frontend/plugins/legacy-plugin-chart-paired-t-test/src/TTestTable.jsx
rename to superset-frontend/plugins/legacy-plugin-chart-paired-t-test/src/TTestTable.tsx
index 9bbaccc432..37f0338731 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-paired-t-test/src/TTestTable.jsx
+++ b/superset-frontend/plugins/legacy-plugin-chart-paired-t-test/src/TTestTable.tsx
@@ -17,8 +17,10 @@
* under the License.
*/
/* eslint-disable react/no-array-index-key, react/jsx-no-bind */
+// @ts-expect-error TS(7016): Could not find a declaration file for module 'dist... Remove this comment to see the full error message
import dist from 'distributions';
import { Component } from 'react';
+// @ts-expect-error TS(7016): Could not find a declaration file for module 'reac... Remove this comment to see the full error message
import { Table, Tr, Td, Thead, Th } from 'reactable';
import PropTypes from 'prop-types';
@@ -50,7 +52,7 @@ const defaultProps = {
};
class TTestTable extends Component {
- constructor(props) {
+ constructor(props: $TSFixMe) {
super(props);
this.state = {
control: 0,
@@ -60,11 +62,13 @@ class TTestTable extends Component {
}
componentDidMount() {
+ // @ts-expect-error TS(2339): Property 'control' does not exist on type 'Readonl... Remove this comment to see the full error message
const { control } = this.state;
this.computeTTest(control); // initially populate table
}
- getLiftStatus(row) {
+ getLiftStatus(row: $TSFixMe) {
+ // @ts-expect-error TS(2339): Property 'control' does not exist on type 'Readonl... Remove this comment to see the full error message
const { control, liftValues } = this.state;
// Get a css class name for coloring
if (row === control) {
@@ -78,7 +82,8 @@ class TTestTable extends Component {
return liftVal >= 0 ? 'true' : 'false'; // green on true, red on false
}
- getPValueStatus(row) {
+ getPValueStatus(row: $TSFixMe) {
+ // @ts-expect-error TS(2339): Property 'control' does not exist on type 'Readonl... Remove this comment to see the full error message
const { control, pValues } = this.state;
if (row === control) {
return 'control';
@@ -91,8 +96,10 @@ class TTestTable extends Component {
return ''; // p-values won't normally be colored
}
- getSignificance(row) {
+ getSignificance(row: $TSFixMe) {
+ // @ts-expect-error TS(2339): Property 'control' does not exist on type 'Readonl... Remove this comment to see the full error message
const { control, pValues } = this.state;
+ // @ts-expect-error TS(2339): Property 'alpha' does not exist on type 'Readonly<... Remove this comment to see the full error message
const { alpha } = this.props;
// Color significant as green, else red
if (row === control) {
@@ -103,12 +110,13 @@ class TTestTable extends Component {
return pValues[row] <= alpha;
}
- computeLift(values, control) {
+ computeLift(values: $TSFixMe, control: $TSFixMe) {
+ // @ts-expect-error TS(2339): Property 'liftValPrec' does not exist on type 'Rea... Remove this comment to see the full error message
const { liftValPrec } = this.props;
// Compute the lift value between two time series
let sumValues = 0;
let sumControl = 0;
- values.forEach((value, i) => {
+ values.forEach((value: $TSFixMe, i: $TSFixMe) => {
sumValues += value.y;
sumControl += control[i].y;
});
@@ -116,14 +124,15 @@ class TTestTable extends Component {
return (((sumValues - sumControl) / sumControl) * 100).toFixed(liftValPrec);
}
- computePValue(values, control) {
+ computePValue(values: $TSFixMe, control: $TSFixMe) {
+ // @ts-expect-error TS(2339): Property 'pValPrec' does not exist on type 'Readon... Remove this comment to see the full error message
const { pValPrec } = this.props;
// Compute the p-value from Student's t-test
// between two time series
let diffSum = 0;
let diffSqSum = 0;
let finiteCount = 0;
- values.forEach((value, i) => {
+ values.forEach((value: $TSFixMe, i: $TSFixMe) => {
const diff = control[i].y - value.y;
/* eslint-disable-next-line */
if (isFinite(diff)) {
@@ -147,9 +156,10 @@ class TTestTable extends Component {
}
}
- computeTTest(control) {
+ computeTTest(control: $TSFixMe) {
// Compute lift and p-values for each row
// against the selected control
+ // @ts-expect-error TS(2339): Property 'data' does not exist on type 'Readonly<{... Remove this comment to see the full error message
const { data } = this.props;
const pValues = [];
const liftValues = [];
@@ -169,7 +179,9 @@ class TTestTable extends Component {
}
render() {
+ // @ts-expect-error TS(2339): Property 'data' does not exist on type 'Readonly<{... Remove this comment to see the full error message
const { data, metric, groups } = this.props;
+ // @ts-expect-error TS(2339): Property 'control' does not exist on type 'Readonl... Remove this comment to see the full error message
const { control, liftValues, pValues } = this.state;
if (!Array.isArray(groups) || groups.length === 0) {
@@ -199,7 +211,7 @@ class TTestTable extends Component {
Significant
</Th>,
);
- const rows = data.map((entry, i) => {
+ const rows = data.map((entry: $TSFixMe, i: $TSFixMe) => {
const values = groups.map(
(
group,
@@ -245,7 +257,7 @@ class TTestTable extends Component {
const sortConfig = groups.concat([
{
column: 'pValue',
- sortFunction: (a, b) => {
+ sortFunction: (a: $TSFixMe, b: $TSFixMe) => {
if (a === 'control') {
return -1;
}
@@ -258,7 +270,7 @@ class TTestTable extends Component {
},
{
column: 'liftValue',
- sortFunction: (a, b) => {
+ sortFunction: (a: $TSFixMe, b: $TSFixMe) => {
if (a === 'control') {
return -1;
}
@@ -271,7 +283,7 @@ class TTestTable extends Component {
},
{
column: 'significant',
- sortFunction: (a, b) => {
+ sortFunction: (a: $TSFixMe, b: $TSFixMe) => {
if (a === 'control') {
return -1;
}
@@ -296,7 +308,9 @@ class TTestTable extends Component {
}
}
+// @ts-expect-error TS(2339): Property 'propTypes' does not exist on type 'typeo... Remove this comment to see the full error message
TTestTable.propTypes = propTypes;
+// @ts-expect-error TS(2339): Property 'defaultProps' does not exist on type 'ty... Remove this comment to see the full error message
TTestTable.defaultProps = defaultProps;
export default TTestTable;
diff --git a/superset-frontend/plugins/legacy-plugin-chart-paired-t-test/src/index.js b/superset-frontend/plugins/legacy-plugin-chart-paired-t-test/src/index.ts
similarity index 100%
rename from superset-frontend/plugins/legacy-plugin-chart-paired-t-test/src/index.js
rename to superset-frontend/plugins/legacy-plugin-chart-paired-t-test/src/index.ts
diff --git a/superset-frontend/plugins/legacy-plugin-chart-paired-t-test/src/transformProps.js b/superset-frontend/plugins/legacy-plugin-chart-paired-t-test/src/transformProps.ts
similarity index 91%
rename from superset-frontend/plugins/legacy-plugin-chart-paired-t-test/src/transformProps.js
rename to superset-frontend/plugins/legacy-plugin-chart-paired-t-test/src/transformProps.ts
index 73027a54a2..ebe84dedfd 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-paired-t-test/src/transformProps.js
+++ b/superset-frontend/plugins/legacy-plugin-chart-paired-t-test/src/transformProps.ts
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-export default function transformProps(chartProps) {
+export default function transformProps(chartProps: $TSFixMe) {
const { formData, queriesData } = chartProps;
const {
groupby,
@@ -31,7 +31,7 @@ export default function transformProps(chartProps) {
data: queriesData[0].data,
groups: groupby,
liftValPrec: parseInt(liftvaluePrecision, 10),
- metrics: metrics.map(metric =>
+ metrics: metrics.map((metric: $TSFixMe) =>
typeof metric === 'string' ? metric : metric.label,
),
pValPrec: parseInt(pvaluePrecision, 10),
diff --git a/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/ParallelCoordinates.js b/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/ParallelCoordinates.ts
similarity index 74%
rename from superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/ParallelCoordinates.js
rename to superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/ParallelCoordinates.ts
index c2970979eb..85654981a9 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/ParallelCoordinates.js
+++ b/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/ParallelCoordinates.ts
@@ -17,6 +17,7 @@
* under the License.
*/
/* eslint-disable react/sort-prop-types */
+// @ts-expect-error TS(7016): Could not find a declaration file for module 'd3v3... Remove this comment to see the full error message
import * as d3 from 'd3v3';
import PropTypes from 'prop-types';
import { getSequentialSchemeRegistry } from '@superset-ui/core';
@@ -37,7 +38,7 @@ const propTypes = {
showDatatable: PropTypes.bool,
};
-function ParallelCoordinates(element, props) {
+function ParallelCoordinates(element: $TSFixMe, props: $TSFixMe) {
const {
data,
width,
@@ -53,17 +54,20 @@ function ParallelCoordinates(element, props) {
const cols = includeSeries ? [series].concat(metrics) : metrics;
const ttypes = {};
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
ttypes[series] = 'string';
- metrics.forEach(v => {
+ metrics.forEach((v: $TSFixMe) => {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
ttypes[v] = 'number';
});
const colorScale = colorMetric
- ? getSequentialSchemeRegistry()
+ ? // @ts-expect-error TS(2532): Object is possibly 'undefined'.
+ getSequentialSchemeRegistry()
.get(linearColorScheme)
- .createLinearScale(d3.extent(data, d => d[colorMetric]))
+ .createLinearScale(d3.extent(data, (d: $TSFixMe) => d[colorMetric]))
: () => 'grey';
- const color = d => colorScale(d[colorMetric]);
+ const color = (d: $TSFixMe) => colorScale(d[colorMetric]);
const container = d3
.select(element)
.classed('superset-legacy-chart-parallel-coordinates', true);
@@ -75,7 +79,9 @@ function ParallelCoordinates(element, props) {
.style('height', `${effHeight}px`)
.classed('parcoords', true);
+ // @ts-expect-error TS(2554): Expected 1 arguments, but got 0.
const chart = parcoords()(div.node())
+ // @ts-expect-error TS(2339): Property 'width' does not exist on type '(selectio... Remove this comment to see the full error message
.width(width)
.color(color)
.alpha(0.5)
@@ -92,6 +98,7 @@ function ParallelCoordinates(element, props) {
if (showDatatable) {
// create data table, row hover highlighting
+ // @ts-expect-error TS(2554): Expected 1 arguments, but got 0.
const grid = divgrid();
container
.append('div')
@@ -101,19 +108,19 @@ function ParallelCoordinates(element, props) {
.classed('parcoords grid', true)
.selectAll('.row')
.on({
- mouseover(d) {
+ mouseover(d: $TSFixMe) {
chart.highlight([d]);
},
mouseout: chart.unhighlight,
});
// update data table on brush event
- chart.on('brush', d => {
+ chart.on('brush', (d: $TSFixMe) => {
d3.select('.grid')
.datum(d)
.call(grid)
.selectAll('.row')
.on({
- mouseover(dd) {
+ mouseover(dd: $TSFixMe) {
chart.highlight([dd]);
},
mouseout: chart.unhighlight,
diff --git a/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/ReactParallelCoordinates.jsx b/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/ReactParallelCoordinates.tsx
similarity index 97%
rename from superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/ReactParallelCoordinates.jsx
rename to superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/ReactParallelCoordinates.tsx
index 740d4043df..1c60365f75 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/ReactParallelCoordinates.jsx
+++ b/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/ReactParallelCoordinates.tsx
@@ -22,7 +22,7 @@ import Component from './ParallelCoordinates';
const ReactComponent = reactify(Component);
-const ParallelCoordinates = ({ className, ...otherProps }) => (
+const ParallelCoordinates = ({ className, ...otherProps }: $TSFixMe) => (
<div className={className}>
<ReactComponent {...otherProps} />
</div>
diff --git a/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/index.js b/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/index.ts
similarity index 100%
rename from superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/index.js
rename to superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/index.ts
diff --git a/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/transformProps.js b/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/transformProps.ts
similarity index 91%
rename from superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/transformProps.js
rename to superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/transformProps.ts
index 5d9a145753..eb4289bab4 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/transformProps.js
+++ b/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/transformProps.ts
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-export default function transformProps(chartProps) {
+export default function transformProps(chartProps: $TSFixMe) {
const { width, height, formData, queriesData } = chartProps;
const {
includeSeries,
@@ -33,7 +33,7 @@ export default function transformProps(chartProps) {
data: queriesData[0].data,
includeSeries,
linearColorScheme,
- metrics: metrics.map(m => m.label || m),
+ metrics: metrics.map((m: $TSFixMe) => m.label || m),
colorMetric:
secondaryMetric && secondaryMetric.label
? secondaryMetric.label
diff --git a/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/vendor/parcoords/d3.parcoords.js b/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/vendor/parcoords/d3.parcoords.ts
similarity index 50%
rename from superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/vendor/parcoords/d3.parcoords.js
rename to superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/vendor/parcoords/d3.parcoords.ts
index 9344f2a985..1c47ce3d45 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/vendor/parcoords/d3.parcoords.js
+++ b/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/vendor/parcoords/d3.parcoords.ts
@@ -1,6 +1,6 @@
/* [LICENSE TBD] */
/* eslint-disable */
-export default function (config) {
+export default function(this: $TSFixMe, config: $TSFixMe) {
var __ = {
data: [],
highlighted: [],
@@ -30,7 +30,8 @@ export default function (config) {
extend(__, config);
- var pc = function (selection) {
+ var pc = function (selection: $TSFixMe) {
+ // @ts-expect-error TS(2339): Property 'selection' does not exist on type '(sele... Remove this comment to see the full error message
selection = pc.selection = d3.select(selection);
__.width = selection[0][0].clientWidth;
@@ -38,11 +39,14 @@ export default function (config) {
// canvas data layers
['marks', 'foreground', 'brushed', 'highlight'].forEach(function (layer) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
canvas[layer] = selection.append('canvas').attr('class', layer)[0][0];
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
ctx[layer] = canvas[layer].getContext('2d');
});
// svg tick and brush layers
+ // @ts-expect-error TS(2339): Property 'svg' does not exist on type '(selection:... Remove this comment to see the full error message
pc.svg = selection
.append('svg')
.attr('width', __.width)
@@ -55,6 +59,7 @@ export default function (config) {
return pc;
};
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
var events = d3.dispatch.apply(
this,
[
@@ -64,6 +69,7 @@ export default function (config) {
'brush',
'brushend',
'axesreorder',
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
].concat(d3.keys(__)),
),
w = function () {
@@ -79,51 +85,68 @@ export default function (config) {
interactive: false,
debug: false,
},
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
xscale = d3.scale.ordinal(),
yscale = {},
dragging = {},
+ // @ts-expect-error TS(6133): 'line' is declared but its value is never read.
line = d3.svg.line(),
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
axis = d3.svg.axis().orient('left').ticks(5),
- g, // groups for axes, brushes
+ g: $TSFixMe, // groups for axes, brushes
ctx = {},
canvas = {},
+ // @ts-expect-error TS(6133): 'clusterCentroids' is declared but its value is ne... Remove this comment to see the full error message
clusterCentroids = [];
// side effects for setters
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
var side_effects = d3.dispatch
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
.apply(this, d3.keys(__))
- .on('composite', function (d) {
+ .on('composite', function (d: $TSFixMe) {
+ // @ts-expect-error TS(2339): Property 'foreground' does not exist on type '{}'.
ctx.foreground.globalCompositeOperation = d.value;
+ // @ts-expect-error TS(2339): Property 'brushed' does not exist on type '{}'.
ctx.brushed.globalCompositeOperation = d.value;
})
- .on('alpha', function (d) {
+ .on('alpha', function (d: $TSFixMe) {
+ // @ts-expect-error TS(2339): Property 'foreground' does not exist on type '{}'.
ctx.foreground.globalAlpha = d.value;
+ // @ts-expect-error TS(2339): Property 'brushed' does not exist on type '{}'.
ctx.brushed.globalAlpha = d.value;
})
- .on('brushedColor', function (d) {
+ .on('brushedColor', function (d: $TSFixMe) {
+ // @ts-expect-error TS(2339): Property 'brushed' does not exist on type '{}'.
ctx.brushed.strokeStyle = d.value;
})
- .on('width', function (d) {
+ .on('width', function (d: $TSFixMe) {
+ // @ts-expect-error TS(2339): Property 'resize' does not exist on type '(selecti... Remove this comment to see the full error message
pc.resize();
})
- .on('height', function (d) {
+ .on('height', function (d: $TSFixMe) {
+ // @ts-expect-error TS(2339): Property 'resize' does not exist on type '(selecti... Remove this comment to see the full error message
pc.resize();
})
- .on('margin', function (d) {
+ .on('margin', function (d: $TSFixMe) {
+ // @ts-expect-error TS(2339): Property 'resize' does not exist on type '(selecti... Remove this comment to see the full error message
pc.resize();
})
- .on('rate', function (d) {
+ .on('rate', function (d: $TSFixMe) {
brushedQueue.rate(d.value);
foregroundQueue.rate(d.value);
})
- .on('dimensions', function (d) {
+ .on('dimensions', function (d: $TSFixMe) {
xscale.domain(__.dimensions);
if (flags.interactive) {
+ // @ts-expect-error TS(2339): Property 'render' does not exist on type '(selecti... Remove this comment to see the full error message
pc.render().updateAxes();
}
})
- .on('bundleDimension', function (d) {
+ .on('bundleDimension', function (d: $TSFixMe) {
+ // @ts-expect-error TS(2339): Property 'detectDimensions' does not exist on type... Remove this comment to see the full error message
if (!__.dimensions.length) pc.detectDimensions();
+ // @ts-expect-error TS(2339): Property 'autoscale' does not exist on type '(sele... Remove this comment to see the full error message
if (!(__.dimensions[0] in yscale)) pc.autoscale();
if (typeof d.value === 'number') {
if (d.value < __.dimensions.length) {
@@ -135,27 +158,34 @@ export default function (config) {
__.bundleDimension = d.value;
}
+ // @ts-expect-error TS(2339): Property 'clusterCentroids' does not exist on type... Remove this comment to see the full error message
__.clusterCentroids = compute_cluster_centroids(__.bundleDimension);
})
- .on('hideAxis', function (d) {
+ .on('hideAxis', function (d: $TSFixMe) {
+ // @ts-expect-error TS(2339): Property 'detectDimensions' does not exist on type... Remove this comment to see the full error message
if (!__.dimensions.length) pc.detectDimensions();
+ // @ts-expect-error TS(2339): Property 'dimensions' does not exist on type '(sel... Remove this comment to see the full error message
pc.dimensions(without(__.dimensions, d.value));
});
// expose the state of the chart
+ // @ts-expect-error TS(2339): Property 'state' does not exist on type '(selectio... Remove this comment to see the full error message
pc.state = __;
+ // @ts-expect-error TS(2339): Property 'flags' does not exist on type '(selectio... Remove this comment to see the full error message
pc.flags = flags;
// create getter/setters
getset(pc, __, events);
// expose events
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
d3.rebind(pc, events, 'on');
// getter/setter with event firing
- function getset(obj, state, events) {
+ function getset(obj: $TSFixMe, state: $TSFixMe, events: $TSFixMe) {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
d3.keys(state).forEach(function (key) {
- obj[key] = function (x) {
+ obj[key] = function (x: $TSFixMe) {
if (!arguments.length) {
return state[key];
}
@@ -168,15 +198,15 @@ export default function (config) {
});
}
- function extend(target, source) {
+ function extend(target: $TSFixMe, source: $TSFixMe) {
for (var key in source) {
target[key] = source[key];
}
return target;
}
- function without(arr, item) {
- return arr.filter(function (elem) {
+ function without(arr: $TSFixMe, item: $TSFixMe) {
+ return arr.filter(function (elem: $TSFixMe) {
return item.indexOf(elem) === -1;
});
}
@@ -201,34 +231,42 @@ export default function (config) {
return [h() + 1, 1];
}
+ // @ts-expect-error TS(2339): Property 'autoscale' does not exist on type '(sele... Remove this comment to see the full error message
pc.autoscale = function () {
// yscale
var defaultScales = {
- date: function (k) {
+ date: function (k: $TSFixMe) {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
var extent = d3.extent(__.data, function (d) {
+ // @ts-expect-error TS(2339): Property 'getTime' does not exist on type 'never'.
return d[k] ? d[k].getTime() : null;
});
// special case if single value
if (extent[0] === extent[1]) {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
return d3.scale.ordinal().domain([extent[0]]).rangePoints(getRange());
}
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
return d3.time.scale().domain(extent).range(getRange());
},
- number: function (k) {
+ number: function (k: $TSFixMe) {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
var extent = d3.extent(__.data, function (d) {
return +d[k];
});
// special case if single value
if (extent[0] === extent[1]) {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
return d3.scale.ordinal().domain([extent[0]]).rangePoints(getRange());
}
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
return d3.scale.linear().domain(extent).range(getRange());
},
- string: function (k) {
+ string: function (k: $TSFixMe) {
var counts = {},
domain = [];
@@ -239,25 +277,31 @@ export default function (config) {
return; // null values will be drawn beyond the horizontal null value separator!
}
if (counts[p[k]] === undefined) {
+ // @ts-expect-error TS(2322): Type 'number' is not assignable to type 'never'.
counts[p[k]] = 1;
} else {
+ // @ts-expect-error TS(2322): Type 'number' is not assignable to type 'never'.
counts[p[k]] = counts[p[k]] + 1;
}
});
domain = Object.getOwnPropertyNames(counts).sort(function (a, b) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
return counts[a] - counts[b];
});
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
return d3.scale.ordinal().domain(domain).rangePoints(getRange());
},
};
__.dimensions.forEach(function (k) {
+ // @ts-expect-error TS(2322): Type 'any' is not assignable to type 'never'.
yscale[k] = defaultScales[__.types[k]](k);
});
__.hideAxis.forEach(function (k) {
+ // @ts-expect-error TS(2322): Type 'any' is not assignable to type 'never'.
yscale[k] = defaultScales[__.types[k]](k);
});
@@ -265,6 +309,7 @@ export default function (config) {
xscale.rangePoints([0, w()], 1);
// canvas sizes
+ // @ts-expect-error TS(2339): Property 'selection' does not exist on type '(sele... Remove this comment to see the full error message
pc.selection
.selectAll('canvas')
.style('margin-top', __.margin.top + 'px')
@@ -273,33 +318,47 @@ export default function (config) {
.attr('height', h() + 2);
// default styles, needs to be set when canvas width changes
+ // @ts-expect-error TS(2339): Property 'foreground' does not exist on type '{}'.
ctx.foreground.strokeStyle = __.color;
+ // @ts-expect-error TS(2339): Property 'foreground' does not exist on type '{}'.
ctx.foreground.lineWidth = 1.4;
+ // @ts-expect-error TS(2339): Property 'foreground' does not exist on type '{}'.
ctx.foreground.globalCompositeOperation = __.composite;
+ // @ts-expect-error TS(2339): Property 'foreground' does not exist on type '{}'.
ctx.foreground.globalAlpha = __.alpha;
+ // @ts-expect-error TS(2339): Property 'brushed' does not exist on type '{}'.
ctx.brushed.strokeStyle = __.brushedColor;
+ // @ts-expect-error TS(2339): Property 'brushed' does not exist on type '{}'.
ctx.brushed.lineWidth = 1.4;
+ // @ts-expect-error TS(2339): Property 'brushed' does not exist on type '{}'.
ctx.brushed.globalCompositeOperation = __.composite;
+ // @ts-expect-error TS(2339): Property 'brushed' does not exist on type '{}'.
ctx.brushed.globalAlpha = __.alpha;
+ // @ts-expect-error TS(2339): Property 'highlight' does not exist on type '{}'.
ctx.highlight.lineWidth = 3;
return this;
};
- pc.scale = function (d, domain) {
+ // @ts-expect-error TS(2339): Property 'scale' does not exist on type '(selectio... Remove this comment to see the full error message
+ pc.scale = function (d: $TSFixMe, domain: $TSFixMe) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
yscale[d].domain(domain);
return this;
};
- pc.flip = function (d) {
+ // @ts-expect-error TS(2339): Property 'flip' does not exist on type '(selection... Remove this comment to see the full error message
+ pc.flip = function (d: $TSFixMe) {
//yscale[d].domain().reverse(); // does not work
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
yscale[d].domain(yscale[d].domain().reverse()); // works
return this;
};
- pc.commonScale = function (global, type) {
+ // @ts-expect-error TS(2339): Property 'commonScale' does not exist on type '(se... Remove this comment to see the full error message
+ pc.commonScale = function (global: $TSFixMe, type: $TSFixMe) {
var t = type || 'number';
if (typeof global === 'undefined') {
global = true;
@@ -311,9 +370,11 @@ export default function (config) {
});
if (global) {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
var extent = d3.extent(
scales
.map(function (p, i) {
+ // @ts-expect-error TS(2339): Property 'domain' does not exist on type 'never'.
return yscale[p].domain();
})
.reduce(function (a, b) {
@@ -322,11 +383,14 @@ export default function (config) {
);
scales.forEach(function (d) {
+ // @ts-expect-error TS(2339): Property 'domain' does not exist on type 'never'.
yscale[d].domain(extent);
});
} else {
scales.forEach(function (k) {
+ // @ts-expect-error TS(2339): Property 'domain' does not exist on type 'never'.
yscale[k].domain(
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
d3.extent(__.data, function (d) {
return +d[k];
}),
@@ -336,19 +400,24 @@ export default function (config) {
// update centroids
if (__.bundleDimension !== null) {
+ // @ts-expect-error TS(2339): Property 'bundleDimension' does not exist on type ... Remove this comment to see the full error message
pc.bundleDimension(__.bundleDimension);
}
return this;
};
+ // @ts-expect-error TS(2339): Property 'detectDimensions' does not exist on type... Remove this comment to see the full error message
pc.detectDimensions = function () {
+ // @ts-expect-error TS(2339): Property 'types' does not exist on type '(selectio... Remove this comment to see the full error message
pc.types(pc.detectDimensionTypes(__.data));
+ // @ts-expect-error TS(2339): Property 'dimensions' does not exist on type '(sel... Remove this comment to see the full error message
pc.dimensions(d3.keys(pc.types()));
return this;
};
// a better "typeof" from this post: http://stackoverflow.com/questions/7390426/better-way-to-get-type-of-a-javascript-variable
- pc.toType = function (v) {
+ // @ts-expect-error TS(2339): Property 'toType' does not exist on type '(selecti... Remove this comment to see the full error message
+ pc.toType = function (v: $TSFixMe) {
return {}.toString
.call(v)
.match(/\s([a-zA-Z]+)/)[1]
@@ -356,36 +425,49 @@ export default function (config) {
};
// try to coerce to number before returning type
- pc.toTypeCoerceNumbers = function (v) {
+ // @ts-expect-error TS(2339): Property 'toTypeCoerceNumbers' does not exist on t... Remove this comment to see the full error message
+ pc.toTypeCoerceNumbers = function (v: $TSFixMe) {
if (parseFloat(v) == v && v != null) {
return 'number';
}
+ // @ts-expect-error TS(2339): Property 'toType' does not exist on type '(selecti... Remove this comment to see the full error message
return pc.toType(v);
};
// attempt to determine types of each dimension based on first row of data
- pc.detectDimensionTypes = function (data) {
+ // @ts-expect-error TS(2339): Property 'detectDimensionTypes' does not exist on ... Remove this comment to see the full error message
+ pc.detectDimensionTypes = function (data: $TSFixMe) {
var types = {};
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
d3.keys(data[0]).forEach(function (col) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
types[col] = pc.toTypeCoerceNumbers(data[0][col]);
});
return types;
};
+ // @ts-expect-error TS(2339): Property 'render' does not exist on type '(selecti... Remove this comment to see the full error message
pc.render = function () {
// try to autodetect dimensions and create scales
+ // @ts-expect-error TS(2339): Property 'detectDimensions' does not exist on type... Remove this comment to see the full error message
if (!__.dimensions.length) pc.detectDimensions();
+ // @ts-expect-error TS(2339): Property 'autoscale' does not exist on type '(sele... Remove this comment to see the full error message
if (!(__.dimensions[0] in yscale)) pc.autoscale();
+ // @ts-expect-error TS(2339): Property 'render' does not exist on type '(selecti... Remove this comment to see the full error message
pc.render[__.mode]();
events.render.call(this);
return this;
};
+ // @ts-expect-error TS(2339): Property 'renderBrushed' does not exist on type '(... Remove this comment to see the full error message
pc.renderBrushed = function () {
+ // @ts-expect-error TS(2339): Property 'detectDimensions' does not exist on type... Remove this comment to see the full error message
if (!__.dimensions.length) pc.detectDimensions();
+ // @ts-expect-error TS(2339): Property 'autoscale' does not exist on type '(sele... Remove this comment to see the full error message
if (!(__.dimensions[0] in yscale)) pc.autoscale();
+ // @ts-expect-error TS(2339): Property 'renderBrushed' does not exist on type '(... Remove this comment to see the full error message
pc.renderBrushed[__.mode]();
events.render.call(this);
@@ -393,6 +475,7 @@ export default function (config) {
};
function isBrushed() {
+ // @ts-expect-error TS(2339): Property 'length' does not exist on type 'true'.
if (__.brushed && __.brushed.length !== __.data.length) return true;
var object = brush.currentMode().brushState();
@@ -405,44 +488,61 @@ export default function (config) {
return false;
}
+ // @ts-expect-error TS(2339): Property 'render' does not exist on type '(selecti... Remove this comment to see the full error message
pc.render.default = function () {
+ // @ts-expect-error TS(2339): Property 'clear' does not exist on type '(selectio... Remove this comment to see the full error message
pc.clear('foreground');
+ // @ts-expect-error TS(2339): Property 'clear' does not exist on type '(selectio... Remove this comment to see the full error message
pc.clear('highlight');
+ // @ts-expect-error TS(2339): Property 'renderBrushed' does not exist on type '(... Remove this comment to see the full error message
pc.renderBrushed.default();
__.data.forEach(path_foreground);
};
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
var foregroundQueue = d3
+ // @ts-expect-error TS(2339): Property 'renderQueue' does not exist on type 'typ... Remove this comment to see the full error message
.renderQueue(path_foreground)
.rate(50)
.clear(function () {
+ // @ts-expect-error TS(2339): Property 'clear' does not exist on type '(selectio... Remove this comment to see the full error message
pc.clear('foreground');
+ // @ts-expect-error TS(2339): Property 'clear' does not exist on type '(selectio... Remove this comment to see the full error message
pc.clear('highlight');
});
+ // @ts-expect-error TS(2339): Property 'render' does not exist on type '(selecti... Remove this comment to see the full error message
pc.render.queue = function () {
+ // @ts-expect-error TS(2339): Property 'renderBrushed' does not exist on type '(... Remove this comment to see the full error message
pc.renderBrushed.queue();
foregroundQueue(__.data);
};
+ // @ts-expect-error TS(2339): Property 'renderBrushed' does not exist on type '(... Remove this comment to see the full error message
pc.renderBrushed.default = function () {
+ // @ts-expect-error TS(2339): Property 'clear' does not exist on type '(selectio... Remove this comment to see the full error message
pc.clear('brushed');
if (isBrushed()) {
+ // @ts-expect-error TS(2339): Property 'forEach' does not exist on type 'boolean... Remove this comment to see the full error message
__.brushed.forEach(path_brushed);
}
};
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
var brushedQueue = d3
+ // @ts-expect-error TS(2339): Property 'renderQueue' does not exist on type 'typ... Remove this comment to see the full error message
.renderQueue(path_brushed)
.rate(50)
.clear(function () {
+ // @ts-expect-error TS(2339): Property 'clear' does not exist on type '(selectio... Remove this comment to see the full error message
pc.clear('brushed');
});
+ // @ts-expect-error TS(2339): Property 'renderBrushed' does not exist on type '(... Remove this comment to see the full error message
pc.renderBrushed.queue = function () {
if (isBrushed()) {
brushedQueue(__.brushed);
@@ -450,31 +550,42 @@ export default function (config) {
brushedQueue([]); // This is needed to clear the currently brushed items
}
};
- function compute_cluster_centroids(d) {
+ function compute_cluster_centroids(d: $TSFixMe) {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
var clusterCentroids = d3.map();
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
var clusterCounts = d3.map();
// determine clusterCounts
__.data.forEach(function (row) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
var scaled = yscale[d](row[d]);
if (!clusterCounts.has(scaled)) {
clusterCounts.set(scaled, 0);
}
var count = clusterCounts.get(scaled);
+ // @ts-expect-error TS(2571): Object is of type 'unknown'.
clusterCounts.set(scaled, count + 1);
});
__.data.forEach(function (row) {
__.dimensions.map(function (p, i) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
var scaled = yscale[d](row[d]);
if (!clusterCentroids.has(scaled)) {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
var map = d3.map();
clusterCentroids.set(scaled, map);
}
+ // @ts-expect-error TS(2571): Object is of type 'unknown'.
if (!clusterCentroids.get(scaled).has(p)) {
+ // @ts-expect-error TS(2571): Object is of type 'unknown'.
clusterCentroids.get(scaled).set(p, 0);
}
+ // @ts-expect-error TS(2571): Object is of type 'unknown'.
var value = clusterCentroids.get(scaled).get(p);
+ // @ts-expect-error TS(2349): This expression is not callable.
value += yscale[p](row[p]) / clusterCounts.get(scaled);
+ // @ts-expect-error TS(2571): Object is of type 'unknown'.
clusterCentroids.get(scaled).set(p, value);
});
});
@@ -482,7 +593,7 @@ export default function (config) {
return clusterCentroids;
}
- function compute_centroids(row) {
+ function compute_centroids(row: $TSFixMe) {
var centroids = [];
var p = __.dimensions;
@@ -491,23 +602,31 @@ export default function (config) {
for (var i = 0; i < cols; ++i) {
// centroids on 'real' axes
var x = position(p[i]);
+ // @ts-expect-error TS(2349): This expression is not callable.
var y = yscale[p[i]](row[p[i]]);
+ // @ts-expect-error TS(2304): Cannot find name '$V'.
centroids.push($V([x, y]));
// centroids on 'virtual' axes
if (i < cols - 1) {
var cx = x + a * (position(p[i + 1]) - x);
+ // @ts-expect-error TS(2349): This expression is not callable.
var cy = y + a * (yscale[p[i + 1]](row[p[i + 1]]) - y);
if (__.bundleDimension !== null) {
+ // @ts-expect-error TS(2339): Property 'clusterCentroids' does not exist on type... Remove this comment to see the full error message
var leftCentroid = __.clusterCentroids
+ // @ts-expect-error TS(2349): This expression is not callable.
.get(yscale[__.bundleDimension](row[__.bundleDimension]))
.get(p[i]);
+ // @ts-expect-error TS(2339): Property 'clusterCentroids' does not exist on type... Remove this comment to see the full error message
var rightCentroid = __.clusterCentroids
+ // @ts-expect-error TS(2349): This expression is not callable.
.get(yscale[__.bundleDimension](row[__.bundleDimension]))
.get(p[i + 1]);
var centroid = 0.5 * (leftCentroid + rightCentroid);
cy = centroid + (1 - __.bundlingStrength) * (cy - centroid);
}
+ // @ts-expect-error TS(2304): Cannot find name '$V'.
centroids.push($V([cx, cy]));
}
}
@@ -515,13 +634,14 @@ export default function (config) {
return centroids;
}
- function compute_control_points(centroids) {
+ function compute_control_points(centroids: $TSFixMe) {
var cols = centroids.length;
var a = __.smoothness;
var cps = [];
cps.push(centroids[0]);
cps.push(
+ // @ts-expect-error TS(2304): Cannot find name '$V'.
$V([
centroids[0].e(1) + a * 2 * (centroids[1].e(1) - centroids[0].e(1)),
centroids[0].e(2),
@@ -538,6 +658,7 @@ export default function (config) {
cps.push(mid.subtract(diff.x(a)));
}
cps.push(
+ // @ts-expect-error TS(2304): Cannot find name '$V'.
$V([
centroids[cols - 1].e(1) +
a * 2 * (centroids[cols - 2].e(1) - centroids[cols - 1].e(1)),
@@ -549,23 +670,31 @@ export default function (config) {
return cps;
}
+ // @ts-expect-error TS(2339): Property 'shadows' does not exist on type '(select... Remove this comment to see the full error message
pc.shadows = function () {
+ // @ts-expect-error TS(2339): Property 'shadows' does not exist on type '{ brush... Remove this comment to see the full error message
flags.shadows = true;
+ // @ts-expect-error TS(2339): Property 'alphaOnBrushed' does not exist on type '... Remove this comment to see the full error message
pc.alphaOnBrushed(0.1);
+ // @ts-expect-error TS(2339): Property 'render' does not exist on type '(selecti... Remove this comment to see the full error message
pc.render();
return this;
};
// draw dots with radius r on the axis line where data intersects
- pc.axisDots = function (r) {
+ // @ts-expect-error TS(2339): Property 'axisDots' does not exist on type '(selec... Remove this comment to see the full error message
+ pc.axisDots = function (r: $TSFixMe) {
var r = r || 0.1;
+ // @ts-expect-error TS(2339): Property 'ctx' does not exist on type '(selection:... Remove this comment to see the full error message
var ctx = pc.ctx.marks;
var startAngle = 0;
var endAngle = 2 * Math.PI;
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
ctx.globalAlpha = d3.min([1 / Math.pow(__.data.length, 1 / 2), 1]);
__.data.forEach(function (d) {
__.dimensions.map(function (p, i) {
ctx.beginPath();
+ // @ts-expect-error TS(2349): This expression is not callable.
ctx.arc(position(p), yscale[p](d[p]), r, startAngle, endAngle);
ctx.stroke();
ctx.fill();
@@ -575,7 +704,7 @@ export default function (config) {
};
// draw single cubic bezier curve
- function single_curve(d, ctx) {
+ function single_curve(d: $TSFixMe, ctx: $TSFixMe) {
var centroids = compute_centroids(d);
var cps = compute_control_points(centroids);
@@ -598,7 +727,7 @@ export default function (config) {
}
// draw single polyline
- function color_path(d, ctx) {
+ function color_path(d: $TSFixMe, ctx: $TSFixMe) {
ctx.beginPath();
if (
(__.bundleDimension !== null && __.bundlingStrength > 0) ||
@@ -612,10 +741,11 @@ export default function (config) {
}
// draw many polylines of the same color
- function paths(data, ctx) {
+ // @ts-expect-error TS(6133): 'paths' is declared but its value is never read.
+ function paths(data: $TSFixMe, ctx: $TSFixMe) {
ctx.clearRect(-1, -1, w() + 2, h() + 2);
ctx.beginPath();
- data.forEach(function (d) {
+ data.forEach(function (d: $TSFixMe) {
if (
(__.bundleDimension !== null && __.bundlingStrength > 0) ||
__.smoothness > 0
@@ -642,55 +772,71 @@ export default function (config) {
return h() + 1;
}
- function single_path(d, ctx) {
+ function single_path(d: $TSFixMe, ctx: $TSFixMe) {
__.dimensions.map(function (p, i) {
if (i == 0) {
ctx.moveTo(
position(p),
+ // @ts-expect-error TS(2349): This expression is not callable.
typeof d[p] == 'undefined' ? getNullPosition() : yscale[p](d[p]),
);
} else {
ctx.lineTo(
position(p),
+ // @ts-expect-error TS(2349): This expression is not callable.
typeof d[p] == 'undefined' ? getNullPosition() : yscale[p](d[p]),
);
}
});
}
- function path_brushed(d, i) {
+ function path_brushed(d: $TSFixMe, i: $TSFixMe) {
if (__.brushedColor !== null) {
+ // @ts-expect-error TS(2339): Property 'brushed' does not exist on type '{}'.
ctx.brushed.strokeStyle = d3.functor(__.brushedColor)(d, i);
} else {
+ // @ts-expect-error TS(2339): Property 'brushed' does not exist on type '{}'.
ctx.brushed.strokeStyle = d3.functor(__.color)(d, i);
}
+ // @ts-expect-error TS(2339): Property 'brushed' does not exist on type '{}'.
return color_path(d, ctx.brushed);
}
- function path_foreground(d, i) {
+ function path_foreground(d: $TSFixMe, i: $TSFixMe) {
+ // @ts-expect-error TS(2339): Property 'foreground' does not exist on type '{}'.
ctx.foreground.strokeStyle = d3.functor(__.color)(d, i);
+ // @ts-expect-error TS(2339): Property 'foreground' does not exist on type '{}'.
return color_path(d, ctx.foreground);
}
- function path_highlight(d, i) {
+ function path_highlight(d: $TSFixMe, i: $TSFixMe) {
+ // @ts-expect-error TS(2339): Property 'highlight' does not exist on type '{}'.
ctx.highlight.strokeStyle = d3.functor(__.color)(d, i);
+ // @ts-expect-error TS(2339): Property 'highlight' does not exist on type '{}'.
return color_path(d, ctx.highlight);
}
- pc.clear = function (layer) {
+ // @ts-expect-error TS(2339): Property 'clear' does not exist on type '(selectio... Remove this comment to see the full error message
+ pc.clear = function (layer: $TSFixMe) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
ctx[layer].clearRect(0, 0, w() + 2, h() + 2);
// This will make sure that the foreground items are transparent
// without the need for changing the opacity style of the foreground canvas
// as this would stop the css styling from working
if (layer === 'brushed' && isBrushed()) {
+ // @ts-expect-error TS(2339): Property 'brushed' does not exist on type '{}'.
ctx.brushed.fillStyle = pc.selection.style('background-color');
+ // @ts-expect-error TS(2339): Property 'brushed' does not exist on type '{}'.
ctx.brushed.globalAlpha = 1 - __.alphaOnBrushed;
+ // @ts-expect-error TS(2339): Property 'brushed' does not exist on type '{}'.
ctx.brushed.fillRect(0, 0, w() + 2, h() + 2);
+ // @ts-expect-error TS(2339): Property 'brushed' does not exist on type '{}'.
ctx.brushed.globalAlpha = __.alpha;
}
return this;
};
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
d3.rebind(
pc,
axis,
@@ -703,51 +849,63 @@ export default function (config) {
'tickFormat',
);
- function flipAxisAndUpdatePCP(dimension) {
+ function flipAxisAndUpdatePCP(this: $TSFixMe, dimension: $TSFixMe) {
+ // @ts-expect-error TS(6133): 'g' is declared but its value is never read.
var g = pc.svg.selectAll('.dimension');
+ // @ts-expect-error TS(2339): Property 'flip' does not exist on type '(selection... Remove this comment to see the full error message
pc.flip(dimension);
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
d3.select(this.parentElement)
.transition()
.duration(1100)
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
.call(axis.scale(yscale[dimension]));
+ // @ts-expect-error TS(2339): Property 'render' does not exist on type '(selecti... Remove this comment to see the full error message
pc.render();
}
function rotateLabels() {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
var delta = d3.event.deltaY;
delta = delta < 0 ? -5 : delta;
delta = delta > 0 ? 5 : delta;
__.dimensionTitleRotation += delta;
+ // @ts-expect-error TS(2339): Property 'svg' does not exist on type '(selection:... Remove this comment to see the full error message
pc.svg
.selectAll('text.label')
.attr(
'transform',
'translate(0,-5) rotate(' + __.dimensionTitleRotation + ')',
);
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
d3.event.preventDefault();
}
- function dimensionLabels(d) {
+ function dimensionLabels(d: $TSFixMe) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
return d in __.dimensionTitles ? __.dimensionTitles[d] : d; // dimension display names
}
+ // @ts-expect-error TS(2339): Property 'createAxes' does not exist on type '(sel... Remove this comment to see the full error message
pc.createAxes = function () {
+ // @ts-expect-error TS(2339): Property 'removeAxes' does not exist on type '(sel... Remove this comment to see the full error message
if (g) pc.removeAxes();
// Add a group element for each dimension.
+ // @ts-expect-error TS(2339): Property 'svg' does not exist on type '(selection:... Remove this comment to see the full error message
g = pc.svg
.selectAll('.dimension')
- .data(__.dimensions, function (d) {
+ .data(__.dimensions, function (d: $TSFixMe) {
return d;
})
.enter()
.append('svg:g')
.attr('class', 'dimension')
- .attr('transform', function (d) {
+ .attr('transform', function (d: $TSFixMe) {
return 'translate(' + xscale(d) + ')';
});
@@ -755,7 +913,8 @@ export default function (config) {
g.append('svg:g')
.attr('class', 'axis')
.attr('transform', 'translate(0,0)')
- .each(function (d) {
+ .each(function(this: $TSFixMe, d: $TSFixMe) {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
d3.select(this).call(axis.scale(yscale[d]));
})
.append('svg:text')
@@ -771,6 +930,7 @@ export default function (config) {
.on('wheel', rotateLabels);
if (__.nullValueSeparator == 'top') {
+ // @ts-expect-error TS(2339): Property 'svg' does not exist on type '(selection:... Remove this comment to see the full error message
pc.svg
.append('line')
.attr('x1', 0)
@@ -782,6 +942,7 @@ export default function (config) {
.attr('fill', 'none')
.attr('shape-rendering', 'crispEdges');
} else if (__.nullValueSeparator == 'bottom') {
+ // @ts-expect-error TS(2339): Property 'svg' does not exist on type '(selection:... Remove this comment to see the full error message
pc.svg
.append('line')
.attr('x1', 0)
@@ -798,12 +959,15 @@ export default function (config) {
return this;
};
+ // @ts-expect-error TS(2339): Property 'removeAxes' does not exist on type '(sel... Remove this comment to see the full error message
pc.removeAxes = function () {
g.remove();
return this;
};
+ // @ts-expect-error TS(2339): Property 'updateAxes' does not exist on type '(sel... Remove this comment to see the full error message
pc.updateAxes = function () {
+ // @ts-expect-error TS(2339): Property 'svg' does not exist on type '(selection:... Remove this comment to see the full error message
var g_data = pc.svg.selectAll('.dimension').data(__.dimensions);
// Enter
@@ -811,14 +975,15 @@ export default function (config) {
.enter()
.append('svg:g')
.attr('class', 'dimension')
- .attr('transform', function (p) {
+ .attr('transform', function (p: $TSFixMe) {
return 'translate(' + position(p) + ')';
})
.style('opacity', 0)
.append('svg:g')
.attr('class', 'axis')
.attr('transform', 'translate(0,0)')
- .each(function (d) {
+ .each(function(this: $TSFixMe, d: $TSFixMe) {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
d3.select(this).call(axis.scale(yscale[d]));
})
.append('svg:text')
@@ -839,7 +1004,8 @@ export default function (config) {
.select('.axis')
.transition()
.duration(1100)
- .each(function (d) {
+ .each(function(this: $TSFixMe, d: $TSFixMe) {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
d3.select(this).call(axis.scale(yscale[d]));
});
g_data
@@ -855,59 +1021,76 @@ export default function (config) {
// Exit
g_data.exit().remove();
+ // @ts-expect-error TS(2339): Property 'svg' does not exist on type '(selection:... Remove this comment to see the full error message
g = pc.svg.selectAll('.dimension');
g.transition()
.duration(1100)
- .attr('transform', function (p) {
+ .attr('transform', function (p: $TSFixMe) {
return 'translate(' + position(p) + ')';
})
.style('opacity', 1);
+ // @ts-expect-error TS(2339): Property 'svg' does not exist on type '(selection:... Remove this comment to see the full error message
pc.svg
.selectAll('.axis')
.transition()
.duration(1100)
- .each(function (d) {
+ .each(function(this: $TSFixMe, d: $TSFixMe) {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
d3.select(this).call(axis.scale(yscale[d]));
});
+ // @ts-expect-error TS(2339): Property 'brushable' does not exist on type '(sele... Remove this comment to see the full error message
if (flags.brushable) pc.brushable();
+ // @ts-expect-error TS(2339): Property 'reorderable' does not exist on type '(se... Remove this comment to see the full error message
if (flags.reorderable) pc.reorderable();
+ // @ts-expect-error TS(2339): Property 'brushMode' does not exist on type '(sele... Remove this comment to see the full error message
if (pc.brushMode() !== 'None') {
+ // @ts-expect-error TS(2339): Property 'brushMode' does not exist on type '(sele... Remove this comment to see the full error message
var mode = pc.brushMode();
+ // @ts-expect-error TS(2339): Property 'brushMode' does not exist on type '(sele... Remove this comment to see the full error message
pc.brushMode('None');
+ // @ts-expect-error TS(2339): Property 'brushMode' does not exist on type '(sele... Remove this comment to see the full error message
pc.brushMode(mode);
}
return this;
};
// Jason Davies, http://bl.ocks.org/1341281
+ // @ts-expect-error TS(2339): Property 'reorderable' does not exist on type '(se... Remove this comment to see the full error message
pc.reorderable = function () {
+ // @ts-expect-error TS(2339): Property 'createAxes' does not exist on type '(sel... Remove this comment to see the full error message
if (!g) pc.createAxes();
g.style('cursor', 'move').call(
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
d3.behavior
.drag()
- .on('dragstart', function (d) {
+ .on('dragstart', function(this: $TSFixMe, d) {
+ // @ts-expect-error TS(2538): Type 'unknown' cannot be used as an index type.
dragging[d] = this.__origin__ = xscale(d);
})
- .on('drag', function (d) {
+ .on('drag', function(this: $TSFixMe, d) {
+ // @ts-expect-error TS(2538): Type 'unknown' cannot be used as an index type.
dragging[d] = Math.min(
w(),
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
Math.max(0, (this.__origin__ += d3.event.dx)),
);
__.dimensions.sort(function (a, b) {
return position(a) - position(b);
});
xscale.domain(__.dimensions);
+ // @ts-expect-error TS(2339): Property 'render' does not exist on type '(selecti... Remove this comment to see the full error message
pc.render();
- g.attr('transform', function (d) {
+ g.attr('transform', function (d: $TSFixMe) {
return 'translate(' + position(d) + ')';
});
})
- .on('dragend', function (d) {
+ .on('dragend', function(this: $TSFixMe, d) {
// Let's see if the order has changed and send out an event if so.
var i = 0,
+ // @ts-expect-error TS(2345): Argument of type 'unknown' is not assignable to pa... Remove this comment to see the full error message
j = __.dimensions.indexOf(d),
elem = this,
parent = this.parentElement;
@@ -939,10 +1122,14 @@ export default function (config) {
}
delete this.__origin__;
+ // @ts-expect-error TS(2538): Type 'unknown' cannot be used as an index type.
delete dragging[d];
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
d3.select(this)
.transition()
+ // @ts-expect-error TS(2345): Argument of type 'unknown' is not assignable to pa... Remove this comment to see the full error message
.attr('transform', 'translate(' + xscale(d) + ')');
+ // @ts-expect-error TS(2339): Property 'render' does not exist on type '(selecti... Remove this comment to see the full error message
pc.render();
}),
);
@@ -953,15 +1140,18 @@ export default function (config) {
// Reorder dimensions, such that the highest value (visually) is on the left and
// the lowest on the right. Visual values are determined by the data values in
// the given row.
- pc.reorder = function (rowdata) {
+ // @ts-expect-error TS(2339): Property 'reorder' does not exist on type '(select... Remove this comment to see the full error message
+ pc.reorder = function (rowdata: $TSFixMe) {
var dims = __.dimensions.slice(0);
__.dimensions.sort(function (a, b) {
+ // @ts-expect-error TS(2349): This expression is not callable.
var pixelDifference = yscale[a](rowdata[a]) - yscale[b](rowdata[b]);
// Array.sort is not necessarily stable, this means that if pixelDifference is zero
// the ordering of dimensions might change unexpectedly. This is solved by sorting on
// variable name in that case.
if (pixelDifference === 0) {
+ // @ts-expect-error TS(2339): Property 'localeCompare' does not exist on type 'n... Remove this comment to see the full error message
return a.localeCompare(b);
} // else
return pixelDifference;
@@ -979,24 +1169,28 @@ export default function (config) {
if (reordered) {
xscale.domain(__.dimensions);
var highlighted = __.highlighted.slice(0);
+ // @ts-expect-error TS(2339): Property 'unhighlight' does not exist on type '(se... Remove this comment to see the full error message
pc.unhighlight();
g.transition()
.duration(1500)
- .attr('transform', function (d) {
+ .attr('transform', function (d: $TSFixMe) {
return 'translate(' + xscale(d) + ')';
});
+ // @ts-expect-error TS(2339): Property 'render' does not exist on type '(selecti... Remove this comment to see the full error message
pc.render();
// pc.highlight() does not check whether highlighted is length zero, so we do that here.
if (highlighted.length !== 0) {
+ // @ts-expect-error TS(2339): Property 'highlight' does not exist on type '(sele... Remove this comment to see the full error message
pc.highlight(highlighted);
}
}
};
// pairs of adjacent dimensions
- pc.adjacent_pairs = function (arr) {
+ // @ts-expect-error TS(2339): Property 'adjacent_pairs' does not exist on type '... Remove this comment to see the full error message
+ pc.adjacent_pairs = function (arr: $TSFixMe) {
var ret = [];
for (var i = 0; i < arr.length - 1; i += 1) {
ret.push([arr[i], arr[i + 1]]);
@@ -1007,8 +1201,8 @@ export default function (config) {
var brush = {
modes: {
None: {
- install: function (pc) {}, // Nothing to be done.
- uninstall: function (pc) {}, // Nothing to be done.
+ install: function (pc: $TSFixMe) {}, // Nothing to be done.
+ uninstall: function (pc: $TSFixMe) {}, // Nothing to be done.
selected: function () {
return [];
}, // Nothing to return
@@ -1020,6 +1214,7 @@ export default function (config) {
mode: 'None',
predicate: 'AND',
currentMode: function () {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
return this.modes[this.mode];
},
};
@@ -1029,13 +1224,14 @@ export default function (config) {
//
// @param newSelection - The new set of data items that is currently contained
// by the brushes
- function brushUpdated(newSelection) {
+ function brushUpdated(newSelection: $TSFixMe) {
__.brushed = newSelection;
events.brush.call(pc, __.brushed);
+ // @ts-expect-error TS(2339): Property 'renderBrushed' does not exist on type '(... Remove this comment to see the full error message
pc.renderBrushed();
}
- function brushPredicate(predicate) {
+ function brushPredicate(predicate: $TSFixMe) {
if (!arguments.length) {
return brush.predicate;
}
@@ -1047,19 +1243,23 @@ export default function (config) {
brush.predicate = predicate;
__.brushed = brush.currentMode().selected();
+ // @ts-expect-error TS(2339): Property 'renderBrushed' does not exist on type '(... Remove this comment to see the full error message
pc.renderBrushed();
return pc;
}
+ // @ts-expect-error TS(2339): Property 'brushModes' does not exist on type '(sel... Remove this comment to see the full error message
pc.brushModes = function () {
return Object.getOwnPropertyNames(brush.modes);
};
- pc.brushMode = function (mode) {
+ // @ts-expect-error TS(2339): Property 'brushMode' does not exist on type '(sele... Remove this comment to see the full error message
+ pc.brushMode = function (mode: $TSFixMe) {
if (arguments.length === 0) {
return brush.mode;
}
+ // @ts-expect-error TS(2339): Property 'brushModes' does not exist on type '(sel... Remove this comment to see the full error message
if (pc.brushModes().indexOf(mode) === -1) {
throw 'pc.brushmode: Unsupported brush mode: ' + mode;
}
@@ -1070,17 +1270,22 @@ export default function (config) {
// When changing brush modes, the first thing we need to do is clearing any
// brushes from the current mode, if any.
if (brush.mode !== 'None') {
+ // @ts-expect-error TS(2339): Property 'brushReset' does not exist on type '(sel... Remove this comment to see the full error message
pc.brushReset();
}
// Next, we need to 'uninstall' the current brushMode.
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
brush.modes[brush.mode].uninstall(pc);
// Finally, we can install the requested one.
brush.mode = mode;
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
brush.modes[brush.mode].install();
if (mode === 'None') {
+ // @ts-expect-error TS(2339): Property 'brushPredicate' does not exist on type '... Remove this comment to see the full error message
delete pc.brushPredicate;
} else {
+ // @ts-expect-error TS(2339): Property 'brushPredicate' does not exist on type '... Remove this comment to see the full error message
pc.brushPredicate = brushPredicate;
}
}
@@ -1093,7 +1298,8 @@ export default function (config) {
(function () {
var brushes = {};
- function is_brushed(p) {
+ function is_brushed(p: $TSFixMe) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
return !brushes[p].empty();
}
@@ -1101,6 +1307,7 @@ export default function (config) {
function selected() {
var actives = __.dimensions.filter(is_brushed),
extents = actives.map(function (p) {
+ // @ts-expect-error TS(2339): Property 'extent' does not exist on type 'never'.
return brushes[p].extent();
});
@@ -1114,11 +1321,14 @@ export default function (config) {
// test if within range
var within = {
- date: function (d, p, dimension) {
+ date: function (d: $TSFixMe, p: $TSFixMe, dimension: $TSFixMe) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
if (typeof yscale[p].rangePoints === 'function') {
// if it is ordinal
return (
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
extents[dimension][0] <= yscale[p](d[p]) &&
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
yscale[p](d[p]) <= extents[dimension][1]
);
} else {
@@ -1127,11 +1337,14 @@ export default function (config) {
);
}
},
- number: function (d, p, dimension) {
+ number: function (d: $TSFixMe, p: $TSFixMe, dimension: $TSFixMe) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
if (typeof yscale[p].rangePoints === 'function') {
// if it is ordinal
return (
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
extents[dimension][0] <= yscale[p](d[p]) &&
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
yscale[p](d[p]) <= extents[dimension][1]
);
} else {
@@ -1140,9 +1353,11 @@ export default function (config) {
);
}
},
- string: function (d, p, dimension) {
+ string: function (d: $TSFixMe, p: $TSFixMe, dimension: $TSFixMe) {
return (
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
extents[dimension][0] <= yscale[p](d[p]) &&
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
yscale[p](d[p]) <= extents[dimension][1]
);
},
@@ -1152,25 +1367,32 @@ export default function (config) {
switch (brush.predicate) {
case 'AND':
return actives.every(function (p, dimension) {
+ // @ts-expect-error TS(2349): This expression is not callable.
return within[__.types[p]](d, p, dimension);
});
case 'OR':
return actives.some(function (p, dimension) {
+ // @ts-expect-error TS(2349): This expression is not callable.
return within[__.types[p]](d, p, dimension);
});
default:
+ // @ts-expect-error TS(2339): Property 'brushPredicate' does not exist on type '... Remove this comment to see the full error message
throw 'Unknown brush predicate ' + __.brushPredicate;
}
});
}
- function brushExtents(extents) {
+ function brushExtents(extents: $TSFixMe) {
if (typeof extents === 'undefined') {
+ // @ts-expect-error TS(2403): Subsequent variable declarations must have the sam... Remove this comment to see the full error message
var extents = {};
__.dimensions.forEach(function (d) {
var brush = brushes[d];
+ // @ts-expect-error TS(2339): Property 'empty' does not exist on type 'never'.
if (brush !== undefined && !brush.empty()) {
+ // @ts-expect-error TS(2339): Property 'extent' does not exist on type 'never'.
var extent = brush.extent();
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
extent.sort(d3.ascending);
extents[d] = extent;
}
@@ -1179,7 +1401,8 @@ export default function (config) {
} else {
//first get all the brush selections
var brushSelections = {};
- g.selectAll('.brush').each(function (d) {
+ g.selectAll('.brush').each(function(this: $TSFixMe, d: $TSFixMe) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
brushSelections[d] = d3.select(this);
});
@@ -1192,27 +1415,35 @@ export default function (config) {
var brush = brushes[d];
if (brush !== undefined) {
//update the extent
+ // @ts-expect-error TS(2339): Property 'extent' does not exist on type 'never'.
brush.extent(extents[d]);
//redraw the brush
+ // @ts-expect-error TS(2349): This expression is not callable.
brush(brushSelections[d]);
//fire some events
+ // @ts-expect-error TS(2339): Property 'event' does not exist on type 'never'.
brush.event(brushSelections[d]);
}
});
//redraw the chart
+ // @ts-expect-error TS(2339): Property 'renderBrushed' does not exist on type '(... Remove this comment to see the full error message
pc.renderBrushed();
}
}
- function brushFor(axis) {
+ function brushFor(axis: $TSFixMe) {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
var brush = d3.svg.brush();
brush
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
.y(yscale[axis])
.on('brushstart', function () {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
if (d3.event.sourceEvent !== null) {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
d3.event.sourceEvent.stopPropagation();
}
})
@@ -1223,27 +1454,32 @@ export default function (config) {
events.brushend.call(pc, __.brushed);
});
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
brushes[axis] = brush;
return brush;
}
- function brushReset(dimension) {
+ function brushReset(this: $TSFixMe, dimension: $TSFixMe) {
__.brushed = false;
if (g) {
- g.selectAll('.brush').each(function (d) {
+ g.selectAll('.brush').each(function(this: $TSFixMe, d: $TSFixMe) {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
d3.select(this).call(brushes[d].clear());
});
+ // @ts-expect-error TS(2339): Property 'renderBrushed' does not exist on type '(... Remove this comment to see the full error message
pc.renderBrushed();
}
return this;
}
function install() {
+ // @ts-expect-error TS(2339): Property 'createAxes' does not exist on type '(sel... Remove this comment to see the full error message
if (!g) pc.createAxes();
// Add and store a brush for each axis.
g.append('svg:g')
.attr('class', 'brush')
- .each(function (d) {
+ .each(function(this: $TSFixMe, d: $TSFixMe) {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
d3.select(this).call(brushFor(d));
})
.selectAll('rect')
@@ -1251,17 +1487,22 @@ export default function (config) {
.attr('x', -15)
.attr('width', 30);
+ // @ts-expect-error TS(2339): Property 'brushExtents' does not exist on type '(s... Remove this comment to see the full error message
pc.brushExtents = brushExtents;
+ // @ts-expect-error TS(2339): Property 'brushReset' does not exist on type '(sel... Remove this comment to see the full error message
pc.brushReset = brushReset;
return pc;
}
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
brush.modes['1D-axes'] = {
install: install,
uninstall: function () {
g.selectAll('.brush').remove();
brushes = {};
+ // @ts-expect-error TS(2339): Property 'brushExtents' does not exist on type '(s... Remove this comment to see the full error message
delete pc.brushExtents;
+ // @ts-expect-error TS(2339): Property 'brushReset' does not exist on type '(sel... Remove this comment to see the full error message
delete pc.brushReset;
},
selected: selected,
@@ -1273,14 +1514,16 @@ export default function (config) {
(function () {
var strums = {},
- strumRect;
+ strumRect: $TSFixMe;
- function drawStrum(strum, activePoint) {
+ function drawStrum(strum: $TSFixMe, activePoint: $TSFixMe) {
+ // @ts-expect-error TS(2339): Property 'selection' does not exist on type '(sele... Remove this comment to see the full error message
var svg = pc.selection.select('svg').select('g#strums'),
id = strum.dims.i,
points = [strum.p1, strum.p2],
line = svg.selectAll('line#strum-' + id).data([strum]),
circles = svg.selectAll('circle#strum-' + id).data(points),
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
drag = d3.behavior.drag();
line
@@ -1290,16 +1533,16 @@ export default function (config) {
.attr('class', 'strum');
line
- .attr('x1', function (d) {
+ .attr('x1', function (d: $TSFixMe) {
return d.p1[0];
})
- .attr('y1', function (d) {
+ .attr('y1', function (d: $TSFixMe) {
return d.p1[1];
})
- .attr('x2', function (d) {
+ .attr('x2', function (d: $TSFixMe) {
return d.p2[0];
})
- .attr('y2', function (d) {
+ .attr('y2', function (d: $TSFixMe) {
return d.p2[1];
})
.attr('stroke', 'black')
@@ -1307,12 +1550,15 @@ export default function (config) {
drag
.on('drag', function (d, i) {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
var ev = d3.event;
i = i + 1;
strum['p' + i][0] = Math.min(
+ // @ts-expect-error TS(2339): Property 'x' does not exist on type 'Event | BaseE... Remove this comment to see the full error message
Math.max(strum.minX + 1, ev.x),
strum.maxX,
);
+ // @ts-expect-error TS(2339): Property 'y' does not exist on type 'Event | BaseE... Remove this comment to see the full error message
strum['p' + i][1] = Math.min(Math.max(strum.minY, ev.y), strum.maxY);
drawStrum(strum, i - 1);
})
@@ -1325,28 +1571,31 @@ export default function (config) {
.attr('class', 'strum');
circles
- .attr('cx', function (d) {
+ .attr('cx', function (d: $TSFixMe) {
return d[0];
})
- .attr('cy', function (d) {
+ .attr('cy', function (d: $TSFixMe) {
return d[1];
})
.attr('r', 5)
- .style('opacity', function (d, i) {
+ .style('opacity', function (d: $TSFixMe, i: $TSFixMe) {
return activePoint !== undefined && i === activePoint ? 0.8 : 0;
})
- .on('mouseover', function () {
+ .on('mouseover', function(this: $TSFixMe) {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
d3.select(this).style('opacity', 0.8);
})
- .on('mouseout', function () {
+ .on('mouseout', function(this: $TSFixMe) {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
d3.select(this).style('opacity', 0);
})
.call(drag);
}
- function dimensionsForPoint(p) {
+ function dimensionsForPoint(p: $TSFixMe) {
var dims = { i: -1, left: undefined, right: undefined };
__.dimensions.some(function (dim, i) {
+ // @ts-expect-error TS(2571): Object is of type 'unknown'.
if (xscale(dim) < p[0]) {
var next = __.dimensions[i + 1];
dims.i = i;
@@ -1378,6 +1627,7 @@ export default function (config) {
// logically only happen between two axes, so no movement outside these axes
// should be allowed.
return function () {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
var p = d3.mouse(strumRect[0][0]),
dims,
strum;
@@ -1389,32 +1639,42 @@ export default function (config) {
(strum = {
p1: p,
dims: dims,
+ // @ts-expect-error TS(2345): Argument of type 'undefined' is not assignable to ... Remove this comment to see the full error message
minX: xscale(dims.left),
+ // @ts-expect-error TS(2345): Argument of type 'undefined' is not assignable to ... Remove this comment to see the full error message
maxX: xscale(dims.right),
minY: 0,
maxY: h(),
});
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
strums[dims.i] = strum;
+ // @ts-expect-error TS(2339): Property 'active' does not exist on type '{}'.
strums.active = dims.i;
// Make sure that the point is within the bounds
+ // @ts-expect-error TS(2345): Argument of type 'unknown' is not assignable to pa... Remove this comment to see the full error message
strum.p1[0] = Math.min(Math.max(strum.minX, p[0]), strum.maxX);
+ // @ts-expect-error TS(2339): Property 'p2' does not exist on type '{ p1: [numbe... Remove this comment to see the full error message
strum.p2 = strum.p1.slice();
};
}
function onDrag() {
return function () {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
var ev = d3.event,
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
strum = strums[strums.active];
// Make sure that the point is within the bounds
strum.p2[0] = Math.min(
+ // @ts-expect-error TS(2339): Property 'x' does not exist on type 'Event | BaseE... Remove this comment to see the full error message
Math.max(strum.minX + 1, ev.x - __.margin.left),
strum.maxX,
);
strum.p2[1] = Math.min(
+ // @ts-expect-error TS(2339): Property 'y' does not exist on type 'Event | BaseE... Remove this comment to see the full error message
Math.max(strum.minY, ev.y - __.margin.top),
strum.maxY,
);
@@ -1422,7 +1682,7 @@ export default function (config) {
};
}
- function containmentTest(strum, width) {
+ function containmentTest(strum: $TSFixMe, width: $TSFixMe) {
var p1 = [strum.p1[0] - strum.minX, strum.p1[1] - strum.minX],
p2 = [strum.p2[0] - strum.minX, strum.p2[1] - strum.minX],
m1 = 1 - width / p1[0],
@@ -1431,7 +1691,7 @@ export default function (config) {
b2 = p2[1] * (1 - m2);
// test if point falls between lines
- return function (p) {
+ return function (p: $TSFixMe) {
var x = p[0],
y = p[1],
y1 = m1 * x + b1,
@@ -1451,15 +1711,20 @@ export default function (config) {
// Get the ids of the currently active strums.
ids = ids.filter(function (d) {
+ // @ts-expect-error TS(2345): Argument of type 'string' is not assignable to par... Remove this comment to see the full error message
return !isNaN(d);
});
- function crossesStrum(d, id) {
+ function crossesStrum(d: $TSFixMe, id: $TSFixMe) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
var strum = strums[id],
+ // @ts-expect-error TS(2339): Property 'width' does not exist on type '{}'.
test = containmentTest(strum, strums.width(id)),
d1 = strum.dims.left,
d2 = strum.dims.right,
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
y1 = yscale[d1],
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
y2 = yscale[d2],
point = [y1(d[d1]) - strum.minX, y2(d[d2]) - strum.minX];
return test(point);
@@ -1480,16 +1745,21 @@ export default function (config) {
return crossesStrum(d, id);
});
default:
+ // @ts-expect-error TS(2339): Property 'brushPredicate' does not exist on type '... Remove this comment to see the full error message
throw 'Unknown brush predicate ' + __.brushPredicate;
}
});
}
function removeStrum() {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
var strum = strums[strums.active],
+ // @ts-expect-error TS(2339): Property 'selection' does not exist on type '(sele... Remove this comment to see the full error message
svg = pc.selection.select('svg').select('g#strums');
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
delete strums[strums.active];
+ // @ts-expect-error TS(2339): Property 'active' does not exist on type '{}'.
strums.active = undefined;
svg.selectAll('line#strum-' + strum.dims.i).remove();
svg.selectAll('circle#strum-' + strum.dims.i).remove();
@@ -1498,6 +1768,7 @@ export default function (config) {
function onDragEnd() {
return function () {
var brushed = __.data,
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
strum = strums[strums.active];
// Okay, somewhat unexpected, but not totally unsurprising, a mousclick is
@@ -1507,42 +1778,54 @@ export default function (config) {
strum.p1[0] === strum.p2[0] &&
strum.p1[1] === strum.p2[1]
) {
+ // @ts-expect-error TS(2554): Expected 0 arguments, but got 1.
removeStrum(strums);
}
+ // @ts-expect-error TS(2554): Expected 0 arguments, but got 1.
brushed = selected(strums);
+ // @ts-expect-error TS(2339): Property 'active' does not exist on type '{}'.
strums.active = undefined;
+ // @ts-expect-error TS(2322): Type 'never[]' is not assignable to type 'boolean'... Remove this comment to see the full error message
__.brushed = brushed;
+ // @ts-expect-error TS(2339): Property 'renderBrushed' does not exist on type '(... Remove this comment to see the full error message
pc.renderBrushed();
events.brushend.call(pc, __.brushed);
};
}
- function brushReset(strums) {
+ function brushReset(strums: $TSFixMe) {
return function () {
var ids = Object.getOwnPropertyNames(strums).filter(function (d) {
+ // @ts-expect-error TS(2345): Argument of type 'string' is not assignable to par... Remove this comment to see the full error message
return !isNaN(d);
});
ids.forEach(function (d) {
strums.active = d;
+ // @ts-expect-error TS(2554): Expected 0 arguments, but got 1.
removeStrum(strums);
});
+ // @ts-expect-error TS(2554): Expected 0 arguments, but got 1.
onDragEnd(strums)();
};
}
function install() {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
var drag = d3.behavior.drag();
// Map of current strums. Strums are stored per segment of the PC. A segment,
// being the area between two axes. The left most area is indexed at 0.
+ // @ts-expect-error TS(2339): Property 'active' does not exist on type '{}'.
strums.active = undefined;
// Returns the width of the PC segment where currently a strum is being
// placed. NOTE: even though they are evenly spaced in our current
// implementation, we keep for when non-even spaced segments are supported as
// well.
- strums.width = function (id) {
+ // @ts-expect-error TS(2339): Property 'width' does not exist on type '{}'.
+ strums.width = function (id: $TSFixMe) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
var strum = strums[id];
if (strum === undefined) {
@@ -1552,13 +1835,15 @@ export default function (config) {
return strum.maxX - strum.minX;
};
+ // @ts-expect-error TS(2339): Property 'on' does not exist on type '(selection: ... Remove this comment to see the full error message
pc.on('axesreorder.strums', function () {
var ids = Object.getOwnPropertyNames(strums).filter(function (d) {
+ // @ts-expect-error TS(2345): Argument of type 'string' is not assignable to par... Remove this comment to see the full error message
return !isNaN(d);
});
// Checks if the first dimension is directly left of the second dimension.
- function consecutive(first, second) {
+ function consecutive(first: $TSFixMe, second: $TSFixMe) {
var length = __.dimensions.length;
return __.dimensions.some(function (d, i) {
return d === first
@@ -1570,19 +1855,24 @@ export default function (config) {
if (ids.length > 0) {
// We have some strums, which might need to be removed.
ids.forEach(function (d) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
var dims = strums[d].dims;
+ // @ts-expect-error TS(2339): Property 'active' does not exist on type '{}'.
strums.active = d;
// If the two dimensions of the current strum are not next to each other
// any more, than we'll need to remove the strum. Otherwise we keep it.
if (!consecutive(dims.left, dims.right)) {
+ // @ts-expect-error TS(2554): Expected 0 arguments, but got 1.
removeStrum(strums);
}
});
+ // @ts-expect-error TS(2554): Expected 0 arguments, but got 1.
onDragEnd(strums)();
}
});
// Add a new svg group in which we draw the strums.
+ // @ts-expect-error TS(2339): Property 'selection' does not exist on type '(sele... Remove this comment to see the full error message
pc.selection
.select('svg')
.append('g')
@@ -1593,16 +1883,21 @@ export default function (config) {
);
// Install the required brushReset function
+ // @ts-expect-error TS(2339): Property 'brushReset' does not exist on type '(sel... Remove this comment to see the full error message
pc.brushReset = brushReset(strums);
drag
+ // @ts-expect-error TS(2554): Expected 0 arguments, but got 1.
.on('dragstart', onDragStart(strums))
+ // @ts-expect-error TS(2554): Expected 0 arguments, but got 1.
.on('drag', onDrag(strums))
+ // @ts-expect-error TS(2554): Expected 0 arguments, but got 1.
.on('dragend', onDragEnd(strums));
// NOTE: The styling needs to be done here and not in the css. This is because
// for 1D brushing, the canvas layers should not listen to
// pointer-events.
+ // @ts-expect-error TS(2339): Property 'selection' does not exist on type '(sele... Remove this comment to see the full error message
strumRect = pc.selection
.select('svg')
.insert('rect', 'g#strums')
@@ -1615,12 +1910,17 @@ export default function (config) {
.call(drag);
}
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
brush.modes['2D-strums'] = {
install: install,
uninstall: function () {
+ // @ts-expect-error TS(2339): Property 'selection' does not exist on type '(sele... Remove this comment to see the full error message
pc.selection.select('svg').select('g#strums').remove();
+ // @ts-expect-error TS(2339): Property 'selection' does not exist on type '(sele... Remove this comment to see the full error message
pc.selection.select('svg').select('rect#strum-events').remove();
+ // @ts-expect-error TS(2339): Property 'on' does not exist on type '(selection: ... Remove this comment to see the full error message
pc.on('axesreorder.strums', undefined);
+ // @ts-expect-error TS(2339): Property 'brushReset' does not exist on type '(sel... Remove this comment to see the full error message
delete pc.brushReset;
strumRect = undefined;
@@ -1636,12 +1936,14 @@ export default function (config) {
// requires d3.svg.multibrush
(function () {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
if (typeof d3.svg.multibrush !== 'function') {
return;
}
var brushes = {};
- function is_brushed(p) {
+ function is_brushed(p: $TSFixMe) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
return !brushes[p].empty();
}
@@ -1649,6 +1951,7 @@ export default function (config) {
function selected() {
var actives = __.dimensions.filter(is_brushed),
extents = actives.map(function (p) {
+ // @ts-expect-error TS(2339): Property 'extent' does not exist on type 'never'.
return brushes[p].extent();
});
@@ -1662,23 +1965,28 @@ export default function (config) {
// test if within range
var within = {
- date: function (d, p, dimension, b) {
+ date: function (d: $TSFixMe, p: $TSFixMe, dimension: $TSFixMe, b: $TSFixMe) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
if (typeof yscale[p].rangePoints === 'function') {
// if it is ordinal
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
return b[0] <= yscale[p](d[p]) && yscale[p](d[p]) <= b[1];
} else {
return b[0] <= d[p] && d[p] <= b[1];
}
},
- number: function (d, p, dimension, b) {
+ number: function (d: $TSFixMe, p: $TSFixMe, dimension: $TSFixMe, b: $TSFixMe) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
if (typeof yscale[p].rangePoints === 'function') {
// if it is ordinal
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
return b[0] <= yscale[p](d[p]) && yscale[p](d[p]) <= b[1];
} else {
return b[0] <= d[p] && d[p] <= b[1];
}
},
- string: function (d, p, dimension, b) {
+ string: function (d: $TSFixMe, p: $TSFixMe, dimension: $TSFixMe, b: $TSFixMe) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
return b[0] <= yscale[p](d[p]) && yscale[p](d[p]) <= b[1];
},
};
@@ -1687,17 +1995,20 @@ export default function (config) {
switch (brush.predicate) {
case 'AND':
return actives.every(function (p, dimension) {
- return extents[dimension].some(function (b) {
+ return extents[dimension].some(function (b: $TSFixMe) {
+ // @ts-expect-error TS(2349): This expression is not callable.
return within[__.types[p]](d, p, dimension, b);
});
});
case 'OR':
return actives.some(function (p, dimension) {
- return extents[dimension].some(function (b) {
+ return extents[dimension].some(function (b: $TSFixMe) {
+ // @ts-expect-error TS(2349): This expression is not callable.
return within[__.types[p]](d, p, dimension, b);
});
});
default:
+ // @ts-expect-error TS(2339): Property 'brushPredicate' does not exist on type '... Remove this comment to see the full error message
throw 'Unknown brush predicate ' + __.brushPredicate;
}
});
@@ -1707,21 +2018,28 @@ export default function (config) {
var extents = {};
__.dimensions.forEach(function (d) {
var brush = brushes[d];
+ // @ts-expect-error TS(2339): Property 'empty' does not exist on type 'never'.
if (brush !== undefined && !brush.empty()) {
+ // @ts-expect-error TS(2339): Property 'extent' does not exist on type 'never'.
var extent = brush.extent();
+ // @ts-expect-error TS(2322): Type 'any' is not assignable to type 'never'.
extents[d] = extent;
}
});
return extents;
}
- function brushFor(axis) {
+ function brushFor(axis: $TSFixMe) {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
var brush = d3.svg.multibrush();
brush
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
.y(yscale[axis])
.on('brushstart', function () {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
if (d3.event.sourceEvent !== null) {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
d3.event.sourceEvent.stopPropagation();
}
})
@@ -1736,35 +2054,40 @@ export default function (config) {
brushUpdated(selected());
events.brushend.call(pc, __.brushed);
})
- .extentAdaption(function (selection) {
+ .extentAdaption(function (selection: $TSFixMe) {
selection.style('visibility', null).attr('x', -15).attr('width', 30);
})
- .resizeAdaption(function (selection) {
+ .resizeAdaption(function (selection: $TSFixMe) {
selection.selectAll('rect').attr('x', -15).attr('width', 30);
});
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
brushes[axis] = brush;
return brush;
}
- function brushReset(dimension) {
+ function brushReset(this: $TSFixMe, dimension: $TSFixMe) {
__.brushed = false;
if (g) {
- g.selectAll('.brush').each(function (d) {
+ g.selectAll('.brush').each(function(this: $TSFixMe, d: $TSFixMe) {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
d3.select(this).call(brushes[d].clear());
});
+ // @ts-expect-error TS(2339): Property 'renderBrushed' does not exist on type '(... Remove this comment to see the full error message
pc.renderBrushed();
}
return this;
}
function install() {
+ // @ts-expect-error TS(2339): Property 'createAxes' does not exist on type '(sel... Remove this comment to see the full error message
if (!g) pc.createAxes();
// Add and store a brush for each axis.
g.append('svg:g')
.attr('class', 'brush')
- .each(function (d) {
+ .each(function(this: $TSFixMe, d: $TSFixMe) {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
d3.select(this).call(brushFor(d));
})
.selectAll('rect')
@@ -1772,17 +2095,22 @@ export default function (config) {
.attr('x', -15)
.attr('width', 30);
+ // @ts-expect-error TS(2339): Property 'brushExtents' does not exist on type '(s... Remove this comment to see the full error message
pc.brushExtents = brushExtents;
+ // @ts-expect-error TS(2339): Property 'brushReset' does not exist on type '(sel... Remove this comment to see the full error message
pc.brushReset = brushReset;
return pc;
}
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
brush.modes['1D-axes-multi'] = {
install: install,
uninstall: function () {
g.selectAll('.brush').remove();
brushes = {};
+ // @ts-expect-error TS(2339): Property 'brushExtents' does not exist on type '(s... Remove this comment to see the full error message
delete pc.brushExtents;
+ // @ts-expect-error TS(2339): Property 'brushReset' does not exist on type '(sel... Remove this comment to see the full error message
delete pc.brushReset;
},
selected: selected,
@@ -1794,9 +2122,10 @@ export default function (config) {
(function () {
var arcs = {},
- strumRect;
+ strumRect: $TSFixMe;
- function drawStrum(arc, activePoint) {
+ function drawStrum(arc: $TSFixMe, activePoint: $TSFixMe) {
+ // @ts-expect-error TS(2339): Property 'selection' does not exist on type '(sele... Remove this comment to see the full error message
var svg = pc.selection.select('svg').select('g#arcs'),
id = arc.dims.i,
points = [arc.p2, arc.p3],
@@ -1805,6 +2134,7 @@ export default function (config) {
{ p1: arc.p1, p2: arc.p3 },
]),
circles = svg.selectAll('circle#arc-' + id).data(points),
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
drag = d3.behavior.drag(),
path = svg.selectAll('path#arc-' + id).data([arc]);
@@ -1827,16 +2157,16 @@ export default function (config) {
.attr('class', 'arc');
line
- .attr('x1', function (d) {
+ .attr('x1', function (d: $TSFixMe) {
return d.p1[0];
})
- .attr('y1', function (d) {
+ .attr('y1', function (d: $TSFixMe) {
return d.p1[1];
})
- .attr('x2', function (d) {
+ .attr('x2', function (d: $TSFixMe) {
return d.p2[0];
})
- .attr('y2', function (d) {
+ .attr('y2', function (d: $TSFixMe) {
return d.p2[1];
})
.attr('stroke', 'black')
@@ -1844,14 +2174,18 @@ export default function (config) {
drag
.on('drag', function (d, i) {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
var ev = d3.event,
angle = 0;
i = i + 2;
+ // @ts-expect-error TS(2339): Property 'x' does not exist on type 'Event | BaseE... Remove this comment to see the full error message
arc['p' + i][0] = Math.min(Math.max(arc.minX + 1, ev.x), arc.maxX);
+ // @ts-expect-error TS(2339): Property 'y' does not exist on type 'Event | BaseE... Remove this comment to see the full error message
arc['p' + i][1] = Math.min(Math.max(arc.minY, ev.y), arc.maxY);
+ // @ts-expect-error TS(2339): Property 'startAngle' does not exist on type '{}'.
angle = i === 3 ? arcs.startAngle(id) : arcs.endAngle(id);
if (
@@ -1882,28 +2216,31 @@ export default function (config) {
.attr('class', 'arc');
circles
- .attr('cx', function (d) {
+ .attr('cx', function (d: $TSFixMe) {
return d[0];
})
- .attr('cy', function (d) {
+ .attr('cy', function (d: $TSFixMe) {
return d[1];
})
.attr('r', 5)
- .style('opacity', function (d, i) {
+ .style('opacity', function (d: $TSFixMe, i: $TSFixMe) {
return activePoint !== undefined && i === activePoint ? 0.8 : 0;
})
- .on('mouseover', function () {
+ .on('mouseover', function(this: $TSFixMe) {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
d3.select(this).style('opacity', 0.8);
})
- .on('mouseout', function () {
+ .on('mouseout', function(this: $TSFixMe) {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
d3.select(this).style('opacity', 0);
})
.call(drag);
}
- function dimensionsForPoint(p) {
+ function dimensionsForPoint(p: $TSFixMe) {
var dims = { i: -1, left: undefined, right: undefined };
__.dimensions.some(function (dim, i) {
+ // @ts-expect-error TS(2571): Object is of type 'unknown'.
if (xscale(dim) < p[0]) {
var next = __.dimensions[i + 1];
dims.i = i;
@@ -1935,6 +2272,7 @@ export default function (config) {
// logically only happen between two axes, so no movement outside these axes
// should be allowed.
return function () {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
var p = d3.mouse(strumRect[0][0]),
dims,
arc;
@@ -1946,36 +2284,48 @@ export default function (config) {
(arc = {
p1: p,
dims: dims,
+ // @ts-expect-error TS(2345): Argument of type 'undefined' is not assignable to ... Remove this comment to see the full error message
minX: xscale(dims.left),
+ // @ts-expect-error TS(2345): Argument of type 'undefined' is not assignable to ... Remove this comment to see the full error message
maxX: xscale(dims.right),
minY: 0,
maxY: h(),
startAngle: undefined,
endAngle: undefined,
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
arc: d3.svg.arc().innerRadius(0),
});
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
arcs[dims.i] = arc;
+ // @ts-expect-error TS(2339): Property 'active' does not exist on type '{}'.
arcs.active = dims.i;
// Make sure that the point is within the bounds
+ // @ts-expect-error TS(2345): Argument of type 'unknown' is not assignable to pa... Remove this comment to see the full error message
arc.p1[0] = Math.min(Math.max(arc.minX, p[0]), arc.maxX);
+ // @ts-expect-error TS(2339): Property 'p2' does not exist on type '{ p1: [numbe... Remove this comment to see the full error message
arc.p2 = arc.p1.slice();
+ // @ts-expect-error TS(2339): Property 'p3' does not exist on type '{ p1: [numbe... Remove this comment to see the full error message
arc.p3 = arc.p1.slice();
};
}
function onDrag() {
return function () {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
var ev = d3.event,
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
arc = arcs[arcs.active];
// Make sure that the point is within the bounds
arc.p2[0] = Math.min(
+ // @ts-expect-error TS(2339): Property 'x' does not exist on type 'Event | BaseE... Remove this comment to see the full error message
Math.max(arc.minX + 1, ev.x - __.margin.left),
arc.maxX,
);
arc.p2[1] = Math.min(
+ // @ts-expect-error TS(2339): Property 'y' does not exist on type 'Event | BaseE... Remove this comment to see the full error message
Math.max(arc.minY, ev.y - __.margin.top),
arc.maxY,
);
@@ -1985,26 +2335,28 @@ export default function (config) {
}
// some helper functions
- function hypothenuse(a, b) {
+ function hypothenuse(a: $TSFixMe, b: $TSFixMe) {
return Math.sqrt(a * a + b * b);
}
+ // @ts-expect-error TS(6133): 'rad' is declared but its value is never read.
var rad = (function () {
var c = Math.PI / 180;
- return function (angle) {
+ return function (angle: $TSFixMe) {
return angle * c;
};
})();
+ // @ts-expect-error TS(6133): 'deg' is declared but its value is never read.
var deg = (function () {
var c = 180 / Math.PI;
- return function (angle) {
+ return function (angle: $TSFixMe) {
return angle * c;
};
})();
// [0, 2*PI] -> [-PI/2, PI/2]
- var signedAngle = function (angle) {
+ var signedAngle = function (angle: $TSFixMe) {
var ret = angle;
if (angle > Math.PI) {
ret = angle - 1.5 * Math.PI;
@@ -2022,7 +2374,7 @@ export default function (config) {
* 'signed' angle, where 0 is the horizontal line (3 o'clock), and +/- PI/2
* are 12 and 6 o'clock respectively.
*/
- function containmentTest(arc) {
+ function containmentTest(arc: $TSFixMe) {
var startAngle = signedAngle(arc.startAngle);
var endAngle = signedAngle(arc.endAngle);
@@ -2033,7 +2385,7 @@ export default function (config) {
}
// test if segment angle is contained in angle interval
- return function (a) {
+ return function (a: $TSFixMe) {
if (a >= startAngle && a <= endAngle) {
return true;
}
@@ -2048,16 +2400,21 @@ export default function (config) {
// Get the ids of the currently active arcs.
ids = ids.filter(function (d) {
+ // @ts-expect-error TS(2345): Argument of type 'string' is not assignable to par... Remove this comment to see the full error message
return !isNaN(d);
});
- function crossesStrum(d, id) {
+ function crossesStrum(d: $TSFixMe, id: $TSFixMe) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
var arc = arcs[id],
test = containmentTest(arc),
d1 = arc.dims.left,
d2 = arc.dims.right,
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
y1 = yscale[d1],
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
y2 = yscale[d2],
+ // @ts-expect-error TS(2339): Property 'width' does not exist on type '{}'.
a = arcs.width(id),
b = y1(d[d1]) - y2(d[d2]),
c = hypothenuse(a, b),
@@ -2080,16 +2437,21 @@ export default function (config) {
return crossesStrum(d, id);
});
default:
+ // @ts-expect-error TS(2339): Property 'brushPredicate' does not exist on type '... Remove this comment to see the full error message
throw 'Unknown brush predicate ' + __.brushPredicate;
}
});
}
function removeStrum() {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
var arc = arcs[arcs.active],
+ // @ts-expect-error TS(2339): Property 'selection' does not exist on type '(sele... Remove this comment to see the full error message
svg = pc.selection.select('svg').select('g#arcs');
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
delete arcs[arcs.active];
+ // @ts-expect-error TS(2339): Property 'active' does not exist on type '{}'.
arcs.active = undefined;
svg.selectAll('line#arc-' + arc.dims.i).remove();
svg.selectAll('circle#arc-' + arc.dims.i).remove();
@@ -2099,58 +2461,73 @@ export default function (config) {
function onDragEnd() {
return function () {
var brushed = __.data,
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
arc = arcs[arcs.active];
// Okay, somewhat unexpected, but not totally unsurprising, a mousclick is
// considered a drag without move. So we have to deal with that case
if (arc && arc.p1[0] === arc.p2[0] && arc.p1[1] === arc.p2[1]) {
+ // @ts-expect-error TS(2554): Expected 0 arguments, but got 1.
removeStrum(arcs);
}
if (arc) {
+ // @ts-expect-error TS(2339): Property 'startAngle' does not exist on type '{}'.
var angle = arcs.startAngle(arcs.active);
arc.startAngle = angle;
arc.endAngle = angle;
arc.arc
+ // @ts-expect-error TS(2339): Property 'length' does not exist on type '{}'.
.outerRadius(arcs.length(arcs.active))
.startAngle(angle)
.endAngle(angle);
}
+ // @ts-expect-error TS(2554): Expected 0 arguments, but got 1.
brushed = selected(arcs);
+ // @ts-expect-error TS(2339): Property 'active' does not exist on type '{}'.
arcs.active = undefined;
+ // @ts-expect-error TS(2322): Type 'never[]' is not assignable to type 'boolean'... Remove this comment to see the full error message
__.brushed = brushed;
+ // @ts-expect-error TS(2339): Property 'renderBrushed' does not exist on type '(... Remove this comment to see the full error message
pc.renderBrushed();
events.brushend.call(pc, __.brushed);
};
}
- function brushReset(arcs) {
+ function brushReset(arcs: $TSFixMe) {
return function () {
var ids = Object.getOwnPropertyNames(arcs).filter(function (d) {
+ // @ts-expect-error TS(2345): Argument of type 'string' is not assignable to par... Remove this comment to see the full error message
return !isNaN(d);
});
ids.forEach(function (d) {
arcs.active = d;
+ // @ts-expect-error TS(2554): Expected 0 arguments, but got 1.
removeStrum(arcs);
});
+ // @ts-expect-error TS(2554): Expected 0 arguments, but got 1.
onDragEnd(arcs)();
};
}
function install() {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
var drag = d3.behavior.drag();
// Map of current arcs. arcs are stored per segment of the PC. A segment,
// being the area between two axes. The left most area is indexed at 0.
+ // @ts-expect-error TS(2339): Property 'active' does not exist on type '{}'.
arcs.active = undefined;
// Returns the width of the PC segment where currently a arc is being
// placed. NOTE: even though they are evenly spaced in our current
// implementation, we keep for when non-even spaced segments are supported as
// well.
- arcs.width = function (id) {
+ // @ts-expect-error TS(2339): Property 'width' does not exist on type '{}'.
+ arcs.width = function (id: $TSFixMe) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
var arc = arcs[id];
if (arc === undefined) {
@@ -2161,7 +2538,8 @@ export default function (config) {
};
// returns angles in [-PI/2, PI/2]
- angle = function (p1, p2) {
+ // @ts-expect-error TS(2552): Cannot find name 'angle'. Did you mean 'Range'?
+ angle = function (p1: $TSFixMe, p2: $TSFixMe) {
var a = p1[0] - p2[0],
b = p1[1] - p2[1],
c = hypothenuse(a, b);
@@ -2170,11 +2548,14 @@ export default function (config) {
};
// returns angles in [0, 2 * PI]
- arcs.endAngle = function (id) {
+ // @ts-expect-error TS(2339): Property 'endAngle' does not exist on type '{}'.
+ arcs.endAngle = function (id: $TSFixMe) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
var arc = arcs[id];
if (arc === undefined) {
return undefined;
}
+ // @ts-expect-error TS(2552): Cannot find name 'angle'. Did you mean 'sAngle'?
var sAngle = angle(arc.p1, arc.p2),
uAngle = -sAngle + Math.PI / 2;
@@ -2185,12 +2566,15 @@ export default function (config) {
return uAngle;
};
- arcs.startAngle = function (id) {
+ // @ts-expect-error TS(2339): Property 'startAngle' does not exist on type '{}'.
+ arcs.startAngle = function (id: $TSFixMe) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
var arc = arcs[id];
if (arc === undefined) {
return undefined;
}
+ // @ts-expect-error TS(2552): Cannot find name 'angle'. Did you mean 'sAngle'?
var sAngle = angle(arc.p1, arc.p3),
uAngle = -sAngle + Math.PI / 2;
@@ -2201,7 +2585,9 @@ export default function (config) {
return uAngle;
};
- arcs.length = function (id) {
+ // @ts-expect-error TS(2339): Property 'length' does not exist on type '{}'.
+ arcs.length = function (id: $TSFixMe) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
var arc = arcs[id];
if (arc === undefined) {
@@ -2215,13 +2601,15 @@ export default function (config) {
return c;
};
+ // @ts-expect-error TS(2339): Property 'on' does not exist on type '(selection: ... Remove this comment to see the full error message
pc.on('axesreorder.arcs', function () {
var ids = Object.getOwnPropertyNames(arcs).filter(function (d) {
+ // @ts-expect-error TS(2345): Argument of type 'string' is not assignable to par... Remove this comment to see the full error message
return !isNaN(d);
});
// Checks if the first dimension is directly left of the second dimension.
- function consecutive(first, second) {
+ function consecutive(first: $TSFixMe, second: $TSFixMe) {
var length = __.dimensions.length;
return __.dimensions.some(function (d, i) {
return d === first
@@ -2233,19 +2621,24 @@ export default function (config) {
if (ids.length > 0) {
// We have some arcs, which might need to be removed.
ids.forEach(function (d) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
var dims = arcs[d].dims;
+ // @ts-expect-error TS(2339): Property 'active' does not exist on type '{}'.
arcs.active = d;
// If the two dimensions of the current arc are not next to each other
// any more, than we'll need to remove the arc. Otherwise we keep it.
if (!consecutive(dims.left, dims.right)) {
+ // @ts-expect-error TS(2554): Expected 0 arguments, but got 1.
removeStrum(arcs);
}
});
+ // @ts-expect-error TS(2554): Expected 0 arguments, but got 1.
onDragEnd(arcs)();
}
});
// Add a new svg group in which we draw the arcs.
+ // @ts-expect-error TS(2339): Property 'selection' does not exist on type '(sele... Remove this comment to see the full error message
pc.selection
.select('svg')
.append('g')
@@ -2256,16 +2649,21 @@ export default function (config) {
);
// Install the required brushReset function
+ // @ts-expect-error TS(2339): Property 'brushReset' does not exist on type '(sel... Remove this comment to see the full error message
pc.brushReset = brushReset(arcs);
drag
+ // @ts-expect-error TS(2554): Expected 0 arguments, but got 1.
.on('dragstart', onDragStart(arcs))
+ // @ts-expect-error TS(2554): Expected 0 arguments, but got 1.
.on('drag', onDrag(arcs))
+ // @ts-expect-error TS(2554): Expected 0 arguments, but got 1.
.on('dragend', onDragEnd(arcs));
// NOTE: The styling needs to be done here and not in the css. This is because
// for 1D brushing, the canvas layers should not listen to
// pointer-events.
+ // @ts-expect-error TS(2339): Property 'selection' does not exist on type '(sele... Remove this comment to see the full error message
strumRect = pc.selection
.select('svg')
.insert('rect', 'g#arcs')
@@ -2278,12 +2676,17 @@ export default function (config) {
.call(drag);
}
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
brush.modes['angular'] = {
install: install,
uninstall: function () {
+ // @ts-expect-error TS(2339): Property 'selection' does not exist on type '(sele... Remove this comment to see the full error message
pc.selection.select('svg').select('g#arcs').remove();
+ // @ts-expect-error TS(2339): Property 'selection' does not exist on type '(sele... Remove this comment to see the full error message
pc.selection.select('svg').select('rect#arc-events').remove();
+ // @ts-expect-error TS(2339): Property 'on' does not exist on type '(selection: ... Remove this comment to see the full error message
pc.on('axesreorder.arcs', undefined);
+ // @ts-expect-error TS(2339): Property 'brushReset' does not exist on type '(sel... Remove this comment to see the full error message
delete pc.brushReset;
strumRect = undefined;
@@ -2295,42 +2698,56 @@ export default function (config) {
};
})();
+ // @ts-expect-error TS(2339): Property 'interactive' does not exist on type '(se... Remove this comment to see the full error message
pc.interactive = function () {
flags.interactive = true;
return this;
};
// expose a few objects
+ // @ts-expect-error TS(2339): Property 'xscale' does not exist on type '(selecti... Remove this comment to see the full error message
pc.xscale = xscale;
+ // @ts-expect-error TS(2339): Property 'yscale' does not exist on type '(selecti... Remove this comment to see the full error message
pc.yscale = yscale;
+ // @ts-expect-error TS(2339): Property 'ctx' does not exist on type '(selection:... Remove this comment to see the full error message
pc.ctx = ctx;
+ // @ts-expect-error TS(2339): Property 'canvas' does not exist on type '(selecti... Remove this comment to see the full error message
pc.canvas = canvas;
+ // @ts-expect-error TS(2339): Property 'g' does not exist on type '(selection: a... Remove this comment to see the full error message
pc.g = function () {
return g;
};
// rescale for height, width and margins
// TODO currently assumes chart is brushable, and destroys old brushes
+ // @ts-expect-error TS(2339): Property 'resize' does not exist on type '(selecti... Remove this comment to see the full error message
pc.resize = function () {
// selection size
+ // @ts-expect-error TS(2339): Property 'selection' does not exist on type '(sele... Remove this comment to see the full error message
pc.selection
.select('svg')
.attr('width', __.width)
.attr('height', __.height);
+ // @ts-expect-error TS(2339): Property 'svg' does not exist on type '(selection:... Remove this comment to see the full error message
pc.svg.attr(
'transform',
'translate(' + __.margin.left + ',' + __.margin.top + ')',
);
// FIXME: the current brush state should pass through
+ // @ts-expect-error TS(2339): Property 'brushReset' does not exist on type '(sel... Remove this comment to see the full error message
if (flags.brushable) pc.brushReset();
// scales
+ // @ts-expect-error TS(2339): Property 'autoscale' does not exist on type '(sele... Remove this comment to see the full error message
pc.autoscale();
// axes, destroys old brushes.
+ // @ts-expect-error TS(2339): Property 'createAxes' does not exist on type '(sel... Remove this comment to see the full error message
if (g) pc.createAxes();
+ // @ts-expect-error TS(2339): Property 'brushable' does not exist on type '(sele... Remove this comment to see the full error message
if (flags.brushable) pc.brushable();
+ // @ts-expect-error TS(2339): Property 'reorderable' does not exist on type '(se... Remove this comment to see the full error message
if (flags.reorderable) pc.reorderable();
events.resize.call(this, {
@@ -2342,13 +2759,16 @@ export default function (config) {
};
// highlight an array of data
- pc.highlight = function (data) {
+ // @ts-expect-error TS(2339): Property 'highlight' does not exist on type '(sele... Remove this comment to see the full error message
+ pc.highlight = function (data: $TSFixMe) {
if (arguments.length === 0) {
return __.highlighted;
}
__.highlighted = data;
+ // @ts-expect-error TS(2339): Property 'clear' does not exist on type '(selectio... Remove this comment to see the full error message
pc.clear('highlight');
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
d3.selectAll([canvas.foreground, canvas.brushed]).classed('faded', true);
data.forEach(path_highlight);
events.highlight.call(this, data);
@@ -2356,16 +2776,20 @@ export default function (config) {
};
// clear highlighting
+ // @ts-expect-error TS(2339): Property 'unhighlight' does not exist on type '(se... Remove this comment to see the full error message
pc.unhighlight = function () {
__.highlighted = [];
+ // @ts-expect-error TS(2339): Property 'clear' does not exist on type '(selectio... Remove this comment to see the full error message
pc.clear('highlight');
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
d3.selectAll([canvas.foreground, canvas.brushed]).classed('faded', false);
return this;
};
// calculate 2d intersection of line a->b with line c->d
// points are objects with x and y properties
- pc.intersection = function (a, b, c, d) {
+ // @ts-expect-error TS(2339): Property 'intersection' does not exist on type '(s... Remove this comment to see the full error message
+ pc.intersection = function (a: $TSFixMe, b: $TSFixMe, c: $TSFixMe, d: $TSFixMe) {
return {
x:
((a.x * b.y - a.y * b.x) * (c.x - d.x) -
@@ -2378,10 +2802,12 @@ export default function (config) {
};
};
- function position(d) {
+ function position(d: $TSFixMe) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
var v = dragging[d];
return v == null ? xscale(d) : v;
}
+ // @ts-expect-error TS(2339): Property 'version' does not exist on type '(select... Remove this comment to see the full error message
pc.version = '0.7.0';
// this descriptive text should live with other introspective methods
pc.toString = function () {
@@ -2389,6 +2815,7 @@ export default function (config) {
'Parallel Coordinates: ' +
__.dimensions.length +
' dimensions (' +
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
d3.keys(__.data[0]).length +
' total) , ' +
__.data.length +
@@ -2399,26 +2826,33 @@ export default function (config) {
return pc;
}
-d3.renderQueue = function (func) {
- var _queue = [], // data to be rendered
+// @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
+d3.renderQueue = function (func: $TSFixMe) {
+ var _queue: $TSFixMe = [], // data to be rendered
_rate = 10, // number of calls per frame
_clear = function () {}, // clearing function
_i = 0; // current iteration
- var rq = function (data) {
+ var rq = function (data: $TSFixMe) {
+ // @ts-expect-error TS(2339): Property 'data' does not exist on type '(data: any... Remove this comment to see the full error message
if (data) rq.data(data);
+ // @ts-expect-error TS(2339): Property 'invalidate' does not exist on type '(dat... Remove this comment to see the full error message
rq.invalidate();
_clear();
+ // @ts-expect-error TS(2339): Property 'render' does not exist on type '(data: a... Remove this comment to see the full error message
rq.render();
};
+ // @ts-expect-error TS(2339): Property 'render' does not exist on type '(data: a... Remove this comment to see the full error message
rq.render = function () {
_i = 0;
var valid = true;
+ // @ts-expect-error TS(2339): Property 'invalidate' does not exist on type '(dat... Remove this comment to see the full error message
rq.invalidate = function () {
valid = false;
};
+ // @ts-expect-error TS(7030): Not all code paths return a value.
function doFrame() {
if (!valid) return true;
if (_i > _queue.length) return true;
@@ -2433,27 +2867,33 @@ d3.renderQueue = function (func) {
_i += _rate;
}
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
d3.timer(doFrame);
};
- rq.data = function (data) {
+ // @ts-expect-error TS(2339): Property 'data' does not exist on type '(data: any... Remove this comment to see the full error message
+ rq.data = function (data: $TSFixMe) {
+ // @ts-expect-error TS(2339): Property 'invalidate' does not exist on type '(dat... Remove this comment to see the full error message
rq.invalidate();
_queue = data.slice(0);
return rq;
};
- rq.rate = function (value) {
+ // @ts-expect-error TS(2339): Property 'rate' does not exist on type '(data: any... Remove this comment to see the full error message
+ rq.rate = function (value: $TSFixMe) {
if (!arguments.length) return _rate;
_rate = value;
return rq;
};
+ // @ts-expect-error TS(2339): Property 'remaining' does not exist on type '(data... Remove this comment to see the full error message
rq.remaining = function () {
return _queue.length - _i;
};
// clear the canvas
- rq.clear = function (func) {
+ // @ts-expect-error TS(2339): Property 'clear' does not exist on type '(data: an... Remove this comment to see the full error message
+ rq.clear = function (func: $TSFixMe) {
if (!arguments.length) {
_clear();
return rq;
@@ -2462,6 +2902,7 @@ d3.renderQueue = function (func) {
return rq;
};
+ // @ts-expect-error TS(2339): Property 'invalidate' does not exist on type '(dat... Remove this comment to see the full error message
rq.invalidate = function () {};
return rq;
diff --git a/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/vendor/parcoords/divgrid.js b/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/vendor/parcoords/divgrid.ts
similarity index 56%
rename from superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/vendor/parcoords/divgrid.js
rename to superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/vendor/parcoords/divgrid.ts
index 2d79761ebd..d7dd499f3e 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/vendor/parcoords/divgrid.js
+++ b/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/vendor/parcoords/divgrid.ts
@@ -1,10 +1,11 @@
/* [LICENSE TBD] */
/* eslint-disable */
// from http://bl.ocks.org/3687826
-export default function (config) {
- var columns = [];
+export default function (config: $TSFixMe) {
+ var columns: $TSFixMe = [];
- var dg = function (selection) {
+ var dg = function (selection: $TSFixMe) {
+ // @ts-expect-error TS(2686): 'd3' refers to a UMD global, but the current file ... Remove this comment to see the full error message
if (columns.length == 0) columns = d3.keys(selection.data()[0][0]);
// header
@@ -20,19 +21,19 @@ export default function (config) {
header
.enter()
.append('div')
- .attr('class', function (d, i) {
+ .attr('class', function (d: $TSFixMe, i: $TSFixMe) {
return 'col-' + i;
})
.classed('cell', true);
- selection.selectAll('.header .cell').text(function (d) {
+ selection.selectAll('.header .cell').text(function (d: $TSFixMe) {
return d;
});
header.exit().remove();
// rows
- var rows = selection.selectAll('.row').data(function (d) {
+ var rows = selection.selectAll('.row').data(function (d: $TSFixMe) {
return d;
});
@@ -43,7 +44,8 @@ export default function (config) {
var cells = selection
.selectAll('.row')
.selectAll('.cell')
- .data(function (d) {
+ .data(function (d: $TSFixMe) {
+ // @ts-expect-error TS(7006): Parameter 'col' implicitly has an 'any' type.
return columns.map(function (col) {
return d[col];
});
@@ -53,21 +55,22 @@ export default function (config) {
cells
.enter()
.append('div')
- .attr('class', function (d, i) {
+ .attr('class', function (d: $TSFixMe, i: $TSFixMe) {
return 'col-' + i;
})
.classed('cell', true);
cells.exit().remove();
- selection.selectAll('.cell').text(function (d) {
+ selection.selectAll('.cell').text(function (d: $TSFixMe) {
return d;
});
return dg;
};
- dg.columns = function (_) {
+ // @ts-expect-error TS(2339): Property 'columns' does not exist on type '(select... Remove this comment to see the full error message
+ dg.columns = function (_: $TSFixMe) {
if (!arguments.length) return columns;
columns = _;
return this;
diff --git a/superset-frontend/plugins/legacy-plugin-chart-partition/src/Partition.js b/superset-frontend/plugins/legacy-plugin-chart-partition/src/Partition.ts
similarity index 83%
rename from superset-frontend/plugins/legacy-plugin-chart-partition/src/Partition.js
rename to superset-frontend/plugins/legacy-plugin-chart-partition/src/Partition.ts
index fddc0f928d..fe2628d2ee 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-partition/src/Partition.js
+++ b/superset-frontend/plugins/legacy-plugin-chart-partition/src/Partition.ts
@@ -20,6 +20,7 @@
/* eslint no-param-reassign: [2, {"props": false}] */
import d3 from 'd3';
import PropTypes from 'prop-types';
+// @ts-expect-error TS(7016): Could not find a declaration file for module 'd3-h... Remove this comment to see the full error message
import { hierarchy } from 'd3-hierarchy';
import {
getNumberFormatter,
@@ -29,11 +30,11 @@ import {
// Compute dx, dy, x, y for each node and
// return an array of nodes in breadth-first order
-function init(root) {
- const flat = [];
+function init(root: $TSFixMe) {
+ const flat: $TSFixMe = [];
const dy = 1 / (root.height + 1);
- let prev = null;
- root.each(n => {
+ let prev: $TSFixMe = null;
+ root.each((n: $TSFixMe) => {
n.y = dy * n.depth;
n.dy = dy;
if (n.parent) {
@@ -53,7 +54,8 @@ function init(root) {
// Declare PropTypes for recursive data structures
// https://github.com/facebook/react/issues/5676
/* eslint-disable-next-line no-undef */
-const lazyFunction = f => () => f().apply(this, arguments);
+// @ts-expect-error TS(2304): Cannot find name 'arguments'.
+const lazyFunction = (f: $TSFixMe) => () => f().apply(this, arguments);
const leafType = PropTypes.shape({
name: PropTypes.string,
val: PropTypes.number.isRequired,
@@ -63,6 +65,7 @@ const parentShape = {
val: PropTypes.number.isRequired,
children: PropTypes.arrayOf(
PropTypes.oneOfType([
+ // @ts-expect-error TS(2345): Argument of type '() => any' is not assignable to ... Remove this comment to see the full error message
PropTypes.shape(lazyFunction(() => parentShape)),
leafType,
]),
@@ -89,7 +92,7 @@ const propTypes = {
useRichTooltip: PropTypes.bool,
};
-function getAncestors(d) {
+function getAncestors(d: $TSFixMe) {
const ancestors = [d];
let node = d;
while (node.parent) {
@@ -102,7 +105,7 @@ function getAncestors(d) {
// This vis is based on
// http://mbostock.github.io/d3/talk/20111018/partition.html
-function Icicle(element, props) {
+function Icicle(element: $TSFixMe, props: $TSFixMe) {
const {
width,
height,
@@ -134,11 +137,11 @@ function Icicle(element, props) {
div.selectAll('*').remove();
const tooltip = div.append('div').classed('partition-tooltip', true);
- function hasDateNode(n) {
+ function hasDateNode(n: $TSFixMe) {
return metrics.includes(n.data.name) && hasTime;
}
- function getCategory(depth) {
+ function getCategory(depth: $TSFixMe) {
if (!depth) {
return 'Metric';
}
@@ -149,7 +152,7 @@ function Icicle(element, props) {
return levels[depth - (hasTime ? 2 : 1)];
}
- function drawVis(i, dat) {
+ function drawVis(i: $TSFixMe, dat: $TSFixMe) {
const datum = dat[i];
const w = width;
const h = height / data.length;
@@ -180,7 +183,7 @@ function Icicle(element, props) {
// node.value determines sorting order
// node.weight determines partition height
// node.sum is the sum of children weights
- root.eachAfter(n => {
+ root.eachAfter((n: $TSFixMe) => {
n.disp = n.data.val;
n.value = n.disp < 0 ? -n.disp : n.disp;
n.weight = n.value;
@@ -200,7 +203,7 @@ function Icicle(element, props) {
: '';
});
// Perform sort by weight
- root.sort((a, b) => {
+ root.sort((a: $TSFixMe, b: $TSFixMe) => {
const v = b.value - a.value;
if (v === 0) {
return b.name > a.name ? 1 : -1;
@@ -213,9 +216,10 @@ function Icicle(element, props) {
// both are applied at the same time
if (partitionThreshold && partitionThreshold >= 0) {
// Compute weight sums as we go
- root.each(n => {
+ root.each((n: $TSFixMe) => {
n.sum = n.children
- ? n.children.reduce((a, v) => a + v.weight, 0) || 1
+ ? n.children.reduce((a: $TSFixMe, v: $TSFixMe) => a + v.weight, 0) ||
+ 1
: 1;
if (n.children) {
// Dates are not ordered by weight
@@ -247,7 +251,7 @@ function Icicle(element, props) {
});
}
if (partitionLimit && partitionLimit >= 0) {
- root.each(n => {
+ root.each((n: $TSFixMe) => {
if (n.children && n.children.length > partitionLimit) {
if (!hasDateNode(n)) {
n.children = n.children.slice(0, partitionLimit);
@@ -256,13 +260,13 @@ function Icicle(element, props) {
});
}
// Compute final weight sums
- root.eachAfter(n => {
+ root.eachAfter((n: $TSFixMe) => {
n.sum = n.children
- ? n.children.reduce((a, v) => a + v.weight, 0) || 1
+ ? n.children.reduce((a: $TSFixMe, v: $TSFixMe) => a + v.weight, 0) || 1
: 1;
});
- function positionAndPopulate(tip, d) {
+ function positionAndPopulate(tip: $TSFixMe, d: $TSFixMe) {
let t = '<table>';
if (useRichTooltip) {
const nodes = getAncestors(d);
@@ -310,7 +314,7 @@ function Icicle(element, props) {
let zoomY = h / 1;
// Keep text centered in its division
- function transform(d) {
+ function transform(d: $TSFixMe) {
return `translate(8,${(d.dx * zoomY) / 2})`;
}
@@ -319,12 +323,12 @@ function Icicle(element, props) {
.data(nodes)
.enter()
.append('svg:g')
- .attr('transform', d => `translate(${x(d.y)},${y(d.x)})`)
- .on('mouseover', d => {
+ .attr('transform', (d: $TSFixMe) => `translate(${x(d.y)},${y(d.x)})`)
+ .on('mouseover', (d: $TSFixMe) => {
tooltip.interrupt().transition().duration(100).style('opacity', 0.9);
positionAndPopulate(tooltip, d);
})
- .on('mousemove', d => {
+ .on('mousemove', (d: $TSFixMe) => {
positionAndPopulate(tooltip, d);
})
.on('mouseout', () => {
@@ -332,7 +336,8 @@ function Icicle(element, props) {
});
// When clicking a subdivision, the vis will zoom into it
- function click(d) {
+ // @ts-expect-error TS(7023): 'click' implicitly has return type 'any' because i... Remove this comment to see the full error message
+ function click(d: $TSFixMe) {
if (!d.children) {
if (d.parent) {
// Clicking on the rightmost level should zoom in
@@ -349,15 +354,18 @@ function Icicle(element, props) {
const t = g
.transition()
.duration(d3.event.altKey ? 7500 : 750)
- .attr('transform', nd => `translate(${x(nd.y)},${y(nd.x)})`);
+ .attr(
+ 'transform',
+ (nd: $TSFixMe) => `translate(${x(nd.y)},${y(nd.x)})`,
+ );
t.select('rect')
.attr('width', d.dy * zoomX)
- .attr('height', nd => nd.dx * zoomY);
+ .attr('height', (nd: $TSFixMe) => nd.dx * zoomY);
t.select('text')
.attr('transform', transform)
- .style('opacity', nd => (nd.dx * zoomY > 12 ? 1 : 0));
+ .style('opacity', (nd: $TSFixMe) => (nd.dx * zoomY > 12 ? 1 : 0));
d3.event.stopPropagation();
@@ -368,13 +376,13 @@ function Icicle(element, props) {
g.append('svg:rect')
.attr('width', root.dy * zoomX)
- .attr('height', d => d.dx * zoomY);
+ .attr('height', (d: $TSFixMe) => d.dx * zoomY);
g.append('svg:text')
.attr('transform', transform)
.attr('dy', '0.35em')
- .style('opacity', d => (d.dx * zoomY > 12 ? 1 : 0))
- .text(d => {
+ .style('opacity', (d: $TSFixMe) => (d.dx * zoomY > 12 ? 1 : 0))
+ .text((d: $TSFixMe) => {
if (!d.disp) {
return d.name;
}
@@ -383,7 +391,7 @@ function Icicle(element, props) {
});
// Apply color scheme
- g.selectAll('rect').style('fill', d => {
+ g.selectAll('rect').style('fill', (d: $TSFixMe) => {
d.color = colorFn(d.name, sliceId);
return d.color;
diff --git a/superset-frontend/plugins/legacy-plugin-chart-partition/src/ReactPartition.jsx b/superset-frontend/plugins/legacy-plugin-chart-partition/src/ReactPartition.tsx
similarity index 97%
rename from superset-frontend/plugins/legacy-plugin-chart-partition/src/ReactPartition.jsx
rename to superset-frontend/plugins/legacy-plugin-chart-partition/src/ReactPartition.tsx
index 538c67fa9e..ab71bed90d 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-partition/src/ReactPartition.jsx
+++ b/superset-frontend/plugins/legacy-plugin-chart-partition/src/ReactPartition.tsx
@@ -21,7 +21,7 @@ import Component from './Partition';
const ReactComponent = reactify(Component);
-const Partition = ({ className, ...otherProps }) => (
+const Partition = ({ className, ...otherProps }: $TSFixMe) => (
<div className={className}>
<ReactComponent {...otherProps} />
</div>
diff --git a/superset-frontend/plugins/legacy-plugin-chart-partition/src/index.js b/superset-frontend/plugins/legacy-plugin-chart-partition/src/index.ts
similarity index 100%
rename from superset-frontend/plugins/legacy-plugin-chart-partition/src/index.js
rename to superset-frontend/plugins/legacy-plugin-chart-partition/src/index.ts
diff --git a/superset-frontend/plugins/legacy-plugin-chart-partition/src/transformProps.js b/superset-frontend/plugins/legacy-plugin-chart-partition/src/transformProps.ts
similarity index 92%
rename from superset-frontend/plugins/legacy-plugin-chart-partition/src/transformProps.js
rename to superset-frontend/plugins/legacy-plugin-chart-partition/src/transformProps.ts
index da58cd6160..09143acd03 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-partition/src/transformProps.js
+++ b/superset-frontend/plugins/legacy-plugin-chart-partition/src/transformProps.ts
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-export default function transformProps(chartProps) {
+export default function transformProps(chartProps: $TSFixMe) {
const { width, height, datasource, formData, queriesData } = chartProps;
const {
colorScheme,
@@ -41,7 +41,7 @@ export default function transformProps(chartProps) {
colorScheme,
dateTimeFormat,
equalDateSize,
- levels: groupby.map(g => verboseMap[g] || g),
+ levels: groupby.map((g: $TSFixMe) => verboseMap[g] || g),
metrics,
numberFormat,
partitionLimit: partitionLimit && parseInt(partitionLimit, 10),
diff --git a/superset-frontend/plugins/legacy-plugin-chart-partition/test/OptionDescription.test.jsx b/superset-frontend/plugins/legacy-plugin-chart-partition/test/OptionDescription.test.tsx
similarity index 93%
rename from superset-frontend/plugins/legacy-plugin-chart-partition/test/OptionDescription.test.jsx
rename to superset-frontend/plugins/legacy-plugin-chart-partition/test/OptionDescription.test.tsx
index 7ee79b079e..63b773e9b3 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-partition/test/OptionDescription.test.jsx
+++ b/superset-frontend/plugins/legacy-plugin-chart-partition/test/OptionDescription.test.tsx
@@ -41,6 +41,7 @@ describe('OptionDescription', () => {
const props = { option: { ...defaultProps.option } };
render(
<ThemeProvider theme={supersetTheme}>
+ // @ts-expect-error TS(2322): Type '{ option: { label: string; description: stri... Remove this comment to see the full error message
<OptionDescription {...props} />
</ThemeProvider>,
);
diff --git a/superset-frontend/plugins/legacy-plugin-chart-rose/src/ReactRose.jsx b/superset-frontend/plugins/legacy-plugin-chart-rose/src/ReactRose.tsx
similarity index 97%
rename from superset-frontend/plugins/legacy-plugin-chart-rose/src/ReactRose.jsx
rename to superset-frontend/plugins/legacy-plugin-chart-rose/src/ReactRose.tsx
index b7a2c0c800..d26d0be940 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-rose/src/ReactRose.jsx
+++ b/superset-frontend/plugins/legacy-plugin-chart-rose/src/ReactRose.tsx
@@ -22,7 +22,7 @@ import Component from './Rose';
const ReactComponent = reactify(Component);
-const Rose = ({ className, ...otherProps }) => (
+const Rose = ({ className, ...otherProps }: $TSFixMe) => (
<div className={className}>
<Global
styles={theme => css`
diff --git a/superset-frontend/plugins/legacy-plugin-chart-rose/src/Rose.js b/superset-frontend/plugins/legacy-plugin-chart-rose/src/Rose.ts
similarity index 62%
rename from superset-frontend/plugins/legacy-plugin-chart-rose/src/Rose.js
rename to superset-frontend/plugins/legacy-plugin-chart-rose/src/Rose.ts
index 93d402cb61..1814991c07 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-rose/src/Rose.js
+++ b/superset-frontend/plugins/legacy-plugin-chart-rose/src/Rose.ts
@@ -21,6 +21,7 @@
/* eslint-disable react/sort-prop-types */
import d3 from 'd3';
import PropTypes from 'prop-types';
+// @ts-expect-error TS(7016): Could not find a declaration file for module 'nvd3... Remove this comment to see the full error message
import nv from 'nvd3-fork';
import {
getTimeFormatter,
@@ -49,7 +50,7 @@ const propTypes = {
colorScheme: PropTypes.string,
};
-function copyArc(d) {
+function copyArc(d: $TSFixMe) {
return {
startAngle: d.startAngle,
endAngle: d.endAngle,
@@ -58,7 +59,7 @@ function copyArc(d) {
};
}
-function sortValues(a, b) {
+function sortValues(a: $TSFixMe, b: $TSFixMe) {
if (a.value === b.value) {
return a.name > b.name ? 1 : -1;
}
@@ -66,7 +67,7 @@ function sortValues(a, b) {
return b.value - a.value;
}
-function Rose(element, props) {
+function Rose(element: $TSFixMe, props: $TSFixMe) {
const {
data,
width,
@@ -106,19 +107,20 @@ function Rose(element, props) {
const legendWrap = g.append('g').attr('class', 'legendWrap');
- function legendData(adatum) {
+ function legendData(adatum: $TSFixMe) {
+ // @ts-expect-error TS(7006): Parameter 'v' implicitly has an 'any' type.
return adatum[times[0]].map((v, i) => ({
disabled: state.disabled[i],
key: v.name,
}));
}
- function tooltipData(d, i, adatum) {
+ function tooltipData(d: $TSFixMe, i: $TSFixMe, adatum: $TSFixMe) {
const timeIndex = Math.floor(d.arcId / numGroups);
const series = useRichTooltip
? adatum[times[timeIndex]]
- .filter(v => !state.disabled[v.id % numGroups])
- .map(v => ({
+ .filter((v: $TSFixMe) => !state.disabled[v.id % numGroups])
+ .map((v: $TSFixMe) => ({
key: v.name,
value: v.value,
color: colorFn(v.name, sliceId),
@@ -139,7 +141,7 @@ function Rose(element, props) {
};
}
- legend.width(width).color(d => colorFn(d.key, sliceId));
+ legend.width(width).color((d: $TSFixMe) => colorFn(d.key, sliceId));
legendWrap.datum(legendData(datum)).call(legend);
tooltip.headerFormatter(timeFormat).valueFormatter(format);
@@ -173,14 +175,15 @@ function Rose(element, props) {
.attr('class', 'groupLabelsWrap');
// Compute inner and outer angles for each data point
- function computeArcStates(adatum) {
+ function computeArcStates(adatum: $TSFixMe) {
// Find the max sum of values across all time
let maxSum = 0;
let grain = 0;
const sums = [];
for (const t of times) {
const sum = datum[t].reduce(
- (a, v, i) => a + (state.disabled[i] ? 0 : v.value),
+ (a: $TSFixMe, v: $TSFixMe, i: $TSFixMe) =>
+ a + (state.disabled[i] ? 0 : v.value),
0,
);
maxSum = sum > maxSum ? sum : maxSum;
@@ -198,7 +201,7 @@ function Rose(element, props) {
// Compute proportion
const P = maxRadius / maxSum;
const Q = P * maxRadius;
- const computeOuterRadius = (value, innerRadius) =>
+ const computeOuterRadius = (value: $TSFixMe, innerRadius: $TSFixMe) =>
useAreaProportions
? Math.sqrt(Q * value + innerRadius * innerRadius)
: P * value + innerRadius;
@@ -230,15 +233,24 @@ function Rose(element, props) {
v.id = arcId;
outerRadius = computeOuterRadius(val, innerRadius);
arcSt.data.push({
+ // @ts-expect-error TS(2322): Type 'number' is not assignable to type 'never'.
startAngle,
+ // @ts-expect-error TS(2322): Type 'number' is not assignable to type 'never'.
endAngle,
+ // @ts-expect-error TS(2322): Type 'number' is not assignable to type 'never'.
innerRadius,
+ // @ts-expect-error TS(2322): Type 'any' is not assignable to type 'never'.
outerRadius,
+ // @ts-expect-error TS(2322): Type 'any' is not assignable to type 'never'.
name,
+ // @ts-expect-error TS(2322): Type 'number' is not assignable to type 'never'.
arcId,
+ // @ts-expect-error TS(2322): Type 'any' is not assignable to type 'never'.
val,
+ // @ts-expect-error TS(2322): Type 'any' is not assignable to type 'never'.
time,
});
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
arcSt.extend[arcId] = {
startAngle,
endAngle,
@@ -246,18 +258,21 @@ function Rose(element, props) {
name,
outerRadius: outerRadius + gro,
};
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
arcSt.push[arcId] = {
startAngle,
endAngle,
innerRadius: innerRadius + gro,
outerRadius: outerRadius + gro,
};
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
arcSt.pieStart[arcId] = {
startAngle,
endAngle,
innerRadius: mini * maxRadius,
outerRadius: maxRadius,
};
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
arcSt.mini[arcId] = {
startAngle,
endAngle,
@@ -267,13 +282,16 @@ function Rose(element, props) {
arcId += 1;
innerRadius = outerRadius;
}
+ // @ts-expect-error TS(2698): Spread types may only be created from object types... Remove this comment to see the full error message
const labelArc = { ...arcSt.data[i * numGroups] };
labelArc.outerRadius = maxRadius + 20;
labelArc.innerRadius = maxRadius + 15;
+ // @ts-expect-error TS(2345): Argument of type 'any' is not assignable to parame... Remove this comment to see the full error message
arcSt.labels.push(labelArc);
for (const v of adatum[t].concat().sort(sortValues)) {
const val = state.disabled[v.id % numGroups] ? 0 : v.value;
pieEndAngle = G * val + pieStartAngle;
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
arcSt.pie[v.id] = {
startAngle: pieStartAngle,
endAngle: pieEndAngle,
@@ -281,6 +299,7 @@ function Rose(element, props) {
outerRadius: maxRadius,
percent: v.value / sums[i],
};
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
arcSt.pieOver[v.id] = {
startAngle: pieStartAngle,
endAngle: pieEndAngle,
@@ -297,47 +316,55 @@ function Rose(element, props) {
let arcSt = computeArcStates(datum);
- function tween(target, resFunc) {
- return function doTween(d) {
+ function tween(target: $TSFixMe, resFunc: $TSFixMe) {
+ return function doTween(d: $TSFixMe) {
const interpolate = d3.interpolate(copyArc(d), copyArc(target));
- return t => resFunc(Object.assign(d, interpolate(t)));
+ return (t: $TSFixMe) => resFunc(Object.assign(d, interpolate(t)));
};
}
- function arcTween(target) {
- return tween(target, d => arc(d));
+ function arcTween(target: $TSFixMe) {
+ return tween(target, (d: $TSFixMe) => arc(d));
}
- function translateTween(target) {
- return tween(target, d => `translate(${arc.centroid(d)})`);
+ function translateTween(target: $TSFixMe) {
+ return tween(target, (d: $TSFixMe) => `translate(${arc.centroid(d)})`);
}
// Grab the ID range of segments stand between
// this segment and the edge of the circle
const segmentsToEdgeCache = {};
- function getSegmentsToEdge(arcId) {
+ function getSegmentsToEdge(arcId: $TSFixMe) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
if (segmentsToEdgeCache[arcId]) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
return segmentsToEdgeCache[arcId];
}
const timeIndex = Math.floor(arcId / numGroups);
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
segmentsToEdgeCache[arcId] = [arcId + 1, numGroups * (timeIndex + 1) - 1];
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
return segmentsToEdgeCache[arcId];
}
// Get the IDs of all segments in a timeIndex
const segmentsInTimeCache = {};
- function getSegmentsInTime(arcId) {
+ function getSegmentsInTime(arcId: $TSFixMe) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
if (segmentsInTimeCache[arcId]) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
return segmentsInTimeCache[arcId];
}
const timeIndex = Math.floor(arcId / numGroups);
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
segmentsInTimeCache[arcId] = [
timeIndex * numGroups,
(timeIndex + 1) * numGroups - 1,
];
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
return segmentsInTimeCache[arcId];
}
@@ -361,13 +388,13 @@ function Rose(element, props) {
.enter()
.append('g')
.attr('class', 'roseLabel')
- .attr('transform', d => `translate(${arc.centroid(d)})`);
+ .attr('transform', (d: $TSFixMe) => `translate(${arc.centroid(d)})`);
labels
.append('text')
.style('text-anchor', 'middle')
.style('fill', '#000')
- .text(d => timeFormat(d.time));
+ .text((d: $TSFixMe) => timeFormat(d.time));
const groupLabels = groupLabelsWrap
.selectAll('g')
@@ -381,19 +408,19 @@ function Rose(element, props) {
.append('text')
.style('text-anchor', 'middle')
.style('fill', '#000')
- .text(d => d.name);
+ .text((d: $TSFixMe) => d.name);
const arcs = ae
.append('path')
.attr('class', 'arc')
- .attr('fill', d => colorFn(d.name, sliceId))
+ .attr('fill', (d: $TSFixMe) => colorFn(d.name, sliceId))
.attr('d', arc);
function mousemove() {
tooltip();
}
- function mouseover(b, i) {
+ function mouseover(this: $TSFixMe, b: $TSFixMe, i: $TSFixMe) {
tooltip.data(tooltipData(b, i, datum)).hidden(false);
const $this = d3.select(this);
$this.classed('hover', true);
@@ -403,14 +430,16 @@ function Rose(element, props) {
.interrupt()
.transition()
.duration(180)
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
.attrTween('d', arcTween(arcSt.extend[i]));
const edge = getSegmentsToEdge(i);
arcs
- .filter(d => edge[0] <= d.arcId && d.arcId <= edge[1])
+ .filter((d: $TSFixMe) => edge[0] <= d.arcId && d.arcId <= edge[1])
.interrupt()
.transition()
.duration(180)
- .attrTween('d', d => arcTween(arcSt.push[d.arcId])(d));
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
+ .attrTween('d', (d: $TSFixMe) => arcTween(arcSt.push[d.arcId])(d));
} else if (!inTransition) {
const segments = getSegmentsInTime(clickId);
if (segments[0] <= b.arcId && b.arcId <= segments[1]) {
@@ -419,12 +448,13 @@ function Rose(element, props) {
.interrupt()
.transition()
.duration(180)
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
.attrTween('d', arcTween(arcSt.pieOver[i]));
}
}
}
- function mouseout(b, i) {
+ function mouseout(this: $TSFixMe, b: $TSFixMe, i: $TSFixMe) {
tooltip.hidden(true);
const $this = d3.select(this);
$this.classed('hover', false);
@@ -437,11 +467,11 @@ function Rose(element, props) {
.attrTween('d', arcTween(arcSt.data[i]));
const edge = getSegmentsToEdge(i);
arcs
- .filter(d => edge[0] <= d.arcId && d.arcId <= edge[1])
+ .filter((d: $TSFixMe) => edge[0] <= d.arcId && d.arcId <= edge[1])
.interrupt()
.transition()
.duration(180)
- .attrTween('d', d => arcTween(arcSt.data[d.arcId])(d));
+ .attrTween('d', (d: $TSFixMe) => arcTween(arcSt.data[d.arcId])(d));
} else if (!inTransition) {
const segments = getSegmentsInTime(clickId);
if (segments[0] <= b.arcId && b.arcId <= segments[1]) {
@@ -450,12 +480,13 @@ function Rose(element, props) {
.interrupt()
.transition()
.duration(180)
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
.attrTween('d', arcTween(arcSt.pie[i]));
}
}
}
- function click(b, i) {
+ function click(b: $TSFixMe, i: $TSFixMe) {
if (inTransition) {
return;
}
@@ -468,7 +499,7 @@ function Rose(element, props) {
.interrupt()
.transition()
.duration(delay)
- .attrTween('transform', d =>
+ .attrTween('transform', (d: $TSFixMe) =>
translateTween({
outerRadius: 0,
innerRadius: 0,
@@ -483,7 +514,9 @@ function Rose(element, props) {
`translate(${arc.centroid({
outerRadius: maxRadius + 20,
innerRadius: maxRadius + 15,
+ // @ts-expect-error TS(2339): Property 'startAngle' does not exist on type 'neve... Remove this comment to see the full error message
startAngle: arcSt.data[i].startAngle,
+ // @ts-expect-error TS(2339): Property 'endAngle' does not exist on type 'never'... Remove this comment to see the full error message
endAngle: arcSt.data[i].endAngle,
})})`,
)
@@ -491,42 +524,50 @@ function Rose(element, props) {
.transition()
.delay(delay)
.duration(delay)
- .attrTween('transform', d =>
+ .attrTween('transform', (d: $TSFixMe) =>
translateTween({
outerRadius: maxRadius + 20,
innerRadius: maxRadius + 15,
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
startAngle: arcSt.pie[segments[0] + d.arcId].startAngle,
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
endAngle: arcSt.pie[segments[0] + d.arcId].endAngle,
})(d),
)
- .style('opacity', d =>
+ .style('opacity', (d: $TSFixMe) =>
state.disabled[d.arcId] ||
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
arcSt.pie[segments[0] + d.arcId].percent < labelThreshold
? 0
: 1,
);
ae.classed(
'clickable',
- d => segments[0] > d.arcId || d.arcId > segments[1],
+ (d: $TSFixMe) => segments[0] > d.arcId || d.arcId > segments[1],
);
arcs
- .filter(d => segments[0] <= d.arcId && d.arcId <= segments[1])
+ .filter(
+ (d: $TSFixMe) => segments[0] <= d.arcId && d.arcId <= segments[1],
+ )
.interrupt()
.transition()
.duration(delay)
- .attrTween('d', d => arcTween(arcSt.pieStart[d.arcId])(d))
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
+ .attrTween('d', (d: $TSFixMe) => arcTween(arcSt.pieStart[d.arcId])(d))
.transition()
.duration(delay)
- .attrTween('d', d => arcTween(arcSt.pie[d.arcId])(d))
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
+ .attrTween('d', (d: $TSFixMe) => arcTween(arcSt.pie[d.arcId])(d))
.each('end', () => {
inTransition = false;
});
arcs
- .filter(d => segments[0] > d.arcId || d.arcId > segments[1])
+ .filter((d: $TSFixMe) => segments[0] > d.arcId || d.arcId > segments[1])
.interrupt()
.transition()
.duration(delay)
- .attrTween('d', d => arcTween(arcSt.mini[d.arcId])(d));
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
+ .attrTween('d', (d: $TSFixMe) => arcTween(arcSt.mini[d.arcId])(d));
} else if (clickId < segments[0] || segments[1] < clickId) {
inTransition = true;
const clickSegments = getSegmentsInTime(clickId);
@@ -535,7 +576,7 @@ function Rose(element, props) {
.transition()
.delay(delay)
.duration(delay)
- .attrTween('transform', d =>
+ .attrTween('transform', (d: $TSFixMe) =>
translateTween(arcSt.labels[d.arcId / numGroups])(d),
)
.style('opacity', 1);
@@ -548,32 +589,41 @@ function Rose(element, props) {
translateTween({
outerRadius: maxRadius + 20,
innerRadius: maxRadius + 15,
+ // @ts-expect-error TS(2339): Property 'startAngle' does not exist on type 'neve... Remove this comment to see the full error message
startAngle: arcSt.data[clickId].startAngle,
+ // @ts-expect-error TS(2339): Property 'endAngle' does not exist on type 'never'... Remove this comment to see the full error message
endAngle: arcSt.data[clickId].endAngle,
}),
)
.style('opacity', 0);
ae.classed('clickable', true);
arcs
- .filter(d => clickSegments[0] <= d.arcId && d.arcId <= clickSegments[1])
+ .filter(
+ (d: $TSFixMe) =>
+ clickSegments[0] <= d.arcId && d.arcId <= clickSegments[1],
+ )
.interrupt()
.transition()
.duration(delay)
- .attrTween('d', d => arcTween(arcSt.pieStart[d.arcId])(d))
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
+ .attrTween('d', (d: $TSFixMe) => arcTween(arcSt.pieStart[d.arcId])(d))
.transition()
.duration(delay)
- .attrTween('d', d => arcTween(arcSt.data[d.arcId])(d))
+ .attrTween('d', (d: $TSFixMe) => arcTween(arcSt.data[d.arcId])(d))
.each('end', () => {
clickId = -1;
inTransition = false;
});
arcs
- .filter(d => clickSegments[0] > d.arcId || d.arcId > clickSegments[1])
+ .filter(
+ (d: $TSFixMe) =>
+ clickSegments[0] > d.arcId || d.arcId > clickSegments[1],
+ )
.interrupt()
.transition()
.delay(delay)
.duration(delay)
- .attrTween('d', d => arcTween(arcSt.data[d.arcId])(d));
+ .attrTween('d', (d: $TSFixMe) => arcTween(arcSt.data[d.arcId])(d));
}
}
@@ -588,14 +638,16 @@ function Rose(element, props) {
.interrupt()
.transition()
.duration(delay)
- .attrTween('d', d => arcTween(nArcSt.data[d.arcId])(d))
+ .attrTween('d', (d: $TSFixMe) => arcTween(nArcSt.data[d.arcId])(d))
.each('end', () => {
inTransition = false;
arcSt = nArcSt;
})
.transition()
.duration(0)
- .style('opacity', d => (state.disabled[d.arcId % numGroups] ? 0 : 1));
+ .style('opacity', (d: $TSFixMe) =>
+ state.disabled[d.arcId % numGroups] ? 0 : 1,
+ );
} else {
const segments = getSegmentsInTime(clickId);
arcs
@@ -603,10 +655,12 @@ function Rose(element, props) {
.interrupt()
.transition()
.duration(delay)
- .attrTween('d', d =>
+ .attrTween('d', (d: $TSFixMe) =>
segments[0] <= d.arcId && d.arcId <= segments[1]
- ? arcTween(nArcSt.pie[d.arcId])(d)
- : arcTween(nArcSt.mini[d.arcId])(d),
+ ? // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
+ arcTween(nArcSt.pie[d.arcId])(d)
+ : // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
+ arcTween(nArcSt.mini[d.arcId])(d),
)
.each('end', () => {
inTransition = false;
@@ -614,21 +668,26 @@ function Rose(element, props) {
})
.transition()
.duration(0)
- .style('opacity', d => (state.disabled[d.arcId % numGroups] ? 0 : 1));
+ .style('opacity', (d: $TSFixMe) =>
+ state.disabled[d.arcId % numGroups] ? 0 : 1,
+ );
groupLabels
.interrupt()
.transition()
.duration(delay)
- .attrTween('transform', d =>
+ .attrTween('transform', (d: $TSFixMe) =>
translateTween({
outerRadius: maxRadius + 20,
innerRadius: maxRadius + 15,
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
startAngle: nArcSt.pie[segments[0] + d.arcId].startAngle,
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
endAngle: nArcSt.pie[segments[0] + d.arcId].endAngle,
})(d),
)
- .style('opacity', d =>
+ .style('opacity', (d: $TSFixMe) =>
state.disabled[d.arcId] ||
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
arcSt.pie[segments[0] + d.arcId].percent < labelThreshold
? 0
: 1,
@@ -636,7 +695,7 @@ function Rose(element, props) {
}
}
- legend.dispatch.on('stateChange', newState => {
+ legend.dispatch.on('stateChange', (newState: $TSFixMe) => {
if (state.disabled !== newState.disabled) {
state.disabled = newState.disabled;
updateActive();
diff --git a/superset-frontend/plugins/legacy-plugin-chart-rose/src/index.js b/superset-frontend/plugins/legacy-plugin-chart-rose/src/index.ts
similarity index 100%
rename from superset-frontend/plugins/legacy-plugin-chart-rose/src/index.js
rename to superset-frontend/plugins/legacy-plugin-chart-rose/src/index.ts
diff --git a/superset-frontend/plugins/legacy-plugin-chart-rose/src/transformProps.js b/superset-frontend/plugins/legacy-plugin-chart-rose/src/transformProps.ts
similarity index 95%
rename from superset-frontend/plugins/legacy-plugin-chart-rose/src/transformProps.js
rename to superset-frontend/plugins/legacy-plugin-chart-rose/src/transformProps.ts
index b907e40ecf..68e73ea074 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-rose/src/transformProps.js
+++ b/superset-frontend/plugins/legacy-plugin-chart-rose/src/transformProps.ts
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-export default function transformProps(chartProps) {
+export default function transformProps(chartProps: $TSFixMe) {
const { width, height, formData, queriesData } = chartProps;
const {
colorScheme,
diff --git a/superset-frontend/plugins/legacy-plugin-chart-world-map/src/ReactWorldMap.jsx b/superset-frontend/plugins/legacy-plugin-chart-world-map/src/ReactWorldMap.tsx
similarity index 95%
rename from superset-frontend/plugins/legacy-plugin-chart-world-map/src/ReactWorldMap.jsx
rename to superset-frontend/plugins/legacy-plugin-chart-world-map/src/ReactWorldMap.tsx
index 15d2edf011..45747996e2 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-world-map/src/ReactWorldMap.jsx
+++ b/superset-frontend/plugins/legacy-plugin-chart-world-map/src/ReactWorldMap.tsx
@@ -22,7 +22,7 @@ import WorldMap from './WorldMap';
const ReactWorldMap = reactify(WorldMap);
-const WorldMapComponent = ({ className, ...otherProps }) => {
+const WorldMapComponent = ({ className, ...otherProps }: $TSFixMe) => {
const theme = useTheme();
return (
<div className={className}>
diff --git a/superset-frontend/plugins/legacy-plugin-chart-world-map/src/WorldMap.js b/superset-frontend/plugins/legacy-plugin-chart-world-map/src/WorldMap.ts
similarity index 80%
rename from superset-frontend/plugins/legacy-plugin-chart-world-map/src/WorldMap.js
rename to superset-frontend/plugins/legacy-plugin-chart-world-map/src/WorldMap.ts
index 5e42550f26..7547df3e83 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-world-map/src/WorldMap.js
+++ b/superset-frontend/plugins/legacy-plugin-chart-world-map/src/WorldMap.ts
@@ -24,6 +24,7 @@ import {
getSequentialSchemeRegistry,
CategoricalColorNamespace,
} from '@superset-ui/core';
+// @ts-expect-error TS(7016): Could not find a declaration file for module 'data... Remove this comment to see the full error message
import Datamap from 'datamaps/dist/datamaps.world.min';
import { ColorBy } from './utils';
@@ -50,7 +51,7 @@ const propTypes = {
formatter: PropTypes.object,
};
-function WorldMap(element, props) {
+function WorldMap(element: $TSFixMe, props: $TSFixMe) {
const {
countryFieldtype,
entity,
@@ -77,30 +78,34 @@ function WorldMap(element, props) {
div.selectAll('*').remove();
// Ignore XXX's to get better normalization
- const filteredData = data.filter(d => d.country && d.country !== 'XXX');
+ const filteredData = data.filter(
+ (d: $TSFixMe) => d.country && d.country !== 'XXX',
+ );
- const extRadius = d3.extent(filteredData, d => Math.sqrt(d.m2));
+ const extRadius = d3.extent(filteredData, (d: $TSFixMe) => Math.sqrt(d.m2));
const radiusScale = d3.scale
.linear()
.domain([extRadius[0], extRadius[1]])
.range([1, maxBubbleSize]);
let processedData;
- let colorFn;
+ let colorFn: $TSFixMe;
if (colorBy === ColorBy.Country) {
colorFn = CategoricalColorNamespace.getScale(colorScheme);
- processedData = filteredData.map(d => ({
+ processedData = filteredData.map((d: $TSFixMe) => ({
...d,
radius: radiusScale(Math.sqrt(d.m2)),
fillColor: colorFn(d.name, sliceId),
}));
} else {
+ // @ts-expect-error TS(2532): Object is possibly 'undefined'.
colorFn = getSequentialSchemeRegistry()
.get(linearColorScheme)
+ // @ts-expect-error TS(2345): Argument of type '[string, string] | [undefined, u... Remove this comment to see the full error message
.createLinearScale(d3Extent(filteredData, d => d.m1));
- processedData = filteredData.map(d => ({
+ processedData = filteredData.map((d: $TSFixMe) => ({
...d,
radius: radiusScale(Math.sqrt(d.m2)),
fillColor: colorFn(d.m1),
@@ -108,21 +113,23 @@ function WorldMap(element, props) {
}
const mapData = {};
- processedData.forEach(d => {
+ processedData.forEach((d: $TSFixMe) => {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
mapData[d.country] = d;
});
- const getCrossFilterDataMask = source => {
+ const getCrossFilterDataMask = (source: $TSFixMe) => {
const selected = Object.values(filterState.selectedValues || {});
const key = source.id || source.country;
const country =
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
countryFieldtype === 'name' ? mapData[key]?.name : mapData[key]?.country;
if (!country) {
return undefined;
}
- let values;
+ let values: $TSFixMe;
if (selected.includes(key)) {
values = [];
} else {
@@ -151,7 +158,7 @@ function WorldMap(element, props) {
};
};
- const handleClick = source => {
+ const handleClick = (source: $TSFixMe) => {
if (!emitCrossFilters) {
return;
}
@@ -165,11 +172,12 @@ function WorldMap(element, props) {
}
};
- const handleContextMenu = source => {
+ const handleContextMenu = (source: $TSFixMe) => {
const pointerEvent = d3.event;
pointerEvent.preventDefault();
const key = source.id || source.country;
const val =
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
countryFieldtype === 'name' ? mapData[key]?.name : mapData[key]?.country;
let drillToDetailFilters;
let drillByFilters;
@@ -213,7 +221,7 @@ function WorldMap(element, props) {
highlightBorderColor: theme.colors.grayscale.light5,
highlightFillColor: color,
highlightBorderWidth: 1,
- popupTemplate: (geo, d) =>
+ popupTemplate: (geo: $TSFixMe, d: $TSFixMe) =>
`<div class="hoverinfo"><strong>${d.name}</strong><br>${formatter(
d.m1,
)}</div>`,
@@ -224,7 +232,7 @@ function WorldMap(element, props) {
borderColor: color,
popupOnHover: !inContextMenu,
radius: null,
- popupTemplate: (geo, d) =>
+ popupTemplate: (geo: $TSFixMe, d: $TSFixMe) =>
`<div class="hoverinfo"><strong>${d.name}</strong><br>${formatter(
d.m2,
)}</div>`,
@@ -239,7 +247,7 @@ function WorldMap(element, props) {
exitDelay: 100,
key: JSON.stringify,
},
- done: datamap => {
+ done: (datamap: $TSFixMe) => {
datamap.svg
.selectAll('.datamaps-subunit')
.on('contextmenu', handleContextMenu)
@@ -262,16 +270,17 @@ function WorldMap(element, props) {
if (filterState.selectedValues?.length > 0) {
d3.selectAll('path.datamaps-subunit')
.filter(
- countryFeature =>
+ (countryFeature: $TSFixMe) =>
!filterState.selectedValues.includes(countryFeature.id),
)
.style('fill-opacity', 0.35);
// hack to ensure that the clicked country's color is preserved
// sometimes the fill color would get default grey value after applying cross filter
- filterState.selectedValues.forEach(value => {
+ filterState.selectedValues.forEach((value: $TSFixMe) => {
d3.select(`path.datamaps-subunit.${value}`).style(
'fill',
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
mapData[value]?.fillColor,
);
});
diff --git a/superset-frontend/plugins/legacy-plugin-chart-world-map/src/index.js b/superset-frontend/plugins/legacy-plugin-chart-world-map/src/index.ts
similarity index 100%
rename from superset-frontend/plugins/legacy-plugin-chart-world-map/src/index.js
rename to superset-frontend/plugins/legacy-plugin-chart-world-map/src/index.ts
diff --git a/superset-frontend/plugins/legacy-plugin-chart-world-map/src/transformProps.js b/superset-frontend/plugins/legacy-plugin-chart-world-map/src/transformProps.ts
similarity index 96%
rename from superset-frontend/plugins/legacy-plugin-chart-world-map/src/transformProps.js
rename to superset-frontend/plugins/legacy-plugin-chart-world-map/src/transformProps.ts
index 4069e29428..103a972be2 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-world-map/src/transformProps.js
+++ b/superset-frontend/plugins/legacy-plugin-chart-world-map/src/transformProps.ts
@@ -19,7 +19,7 @@
import { rgb } from 'd3-color';
import { getValueFormatter } from '@superset-ui/core';
-export default function transformProps(chartProps) {
+export default function transformProps(chartProps: $TSFixMe) {
const {
width,
height,
diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/Multi/Multi.tsx b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/Multi/Multi.tsx
index 153a3e7917..0c0881b1b0 100644
--- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/Multi/Multi.tsx
+++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/Multi/Multi.tsx
@@ -144,7 +144,7 @@ const DeckMulti = (props: DeckMultiProps) => {
endpoint: url,
})
.then(({ json }) => {
- // @ts-ignore TODO(hainenber): define proper type for `form_data.viz_type` and call signature for functions in layerGenerators.
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
const layer = layerGenerators[subsliceCopy.form_data.viz_type](
subsliceCopy.form_data,
json,
diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Grid/Grid.tsx b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Grid/Grid.tsx
index d2c86bd878..055d323005 100644
--- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Grid/Grid.tsx
+++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Grid/Grid.tsx
@@ -78,9 +78,9 @@ export function getLayer(
extruded: fd.extruded,
colorRange,
outline: false,
- // @ts-ignore
+ // @ts-expect-error TS(2322): Type '(arr: number[]) => number | number[] | undef... Remove this comment to see the full error message
getElevationValue: aggFunc,
- // @ts-ignore
+ // @ts-expect-error TS(2322): Type '(arr: number[]) => number | number[] | undef... Remove this comment to see the full error message
getColorValue: aggFunc,
...commonLayerProps(fd, setTooltip, setTooltipContent),
});
diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Hex/Hex.tsx b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Hex/Hex.tsx
index ef79b1fa07..14dc8298cb 100644
--- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Hex/Hex.tsx
+++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Hex/Hex.tsx
@@ -76,9 +76,9 @@ export function getLayer(
extruded: fd.extruded,
colorRange,
outline: false,
- // @ts-ignore
+ // @ts-expect-error TS(2322): Type '(arr: number[]) => number | number[] | undef... Remove this comment to see the full error message
getElevationValue: aggFunc,
- // @ts-ignore
+ // @ts-expect-error TS(2322): Type '(arr: number[]) => number | number[] | undef... Remove this comment to see the full error message
getColorValue: aggFunc,
...commonLayerProps(fd, setTooltip, setTooltipContent),
});
diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/utilities/Shared_DeckGL.jsx b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/utilities/Shared_DeckGL.tsx
similarity index 97%
rename from superset-frontend/plugins/legacy-preset-chart-deckgl/src/utilities/Shared_DeckGL.jsx
rename to superset-frontend/plugins/legacy-preset-chart-deckgl/src/utilities/Shared_DeckGL.tsx
index 83491f86f7..76dba2ca52 100644
--- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/utilities/Shared_DeckGL.jsx
+++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/utilities/Shared_DeckGL.tsx
@@ -51,8 +51,8 @@ const jsFunctionInfo = (
);
function jsFunctionControl(
- label,
- description,
+ label: $TSFixMe,
+ description: $TSFixMe,
extraDescr = null,
height = 100,
defaultText = '',
@@ -196,7 +196,7 @@ export const lineColumn = {
label: t('Lines column'),
default: null,
description: t('The database columns that contains lines information'),
- mapStateToProps: state => ({
+ mapStateToProps: (state: $TSFixMe) => ({
choices: columnChoices(state.datasource),
}),
validators: [validateNonEmpty],
@@ -307,7 +307,7 @@ export const spatial = {
label: t('Longitude & Latitude'),
validators: [validateNonEmpty],
description: t('Point to your spatial columns'),
- mapStateToProps: state => ({
+ mapStateToProps: (state: $TSFixMe) => ({
choices: columnChoices(state.datasource),
}),
},
@@ -320,7 +320,7 @@ export const pointRadiusFixed = {
label: t('Point Size'),
default: { type: 'fix', value: 1000 },
description: t('Fixed point radius'),
- mapStateToProps: state => ({
+ mapStateToProps: (state: $TSFixMe) => ({
datasource: state.datasource,
}),
},
@@ -395,7 +395,7 @@ export const geojsonColumn = {
label: t('GeoJson Column'),
validators: [validateNonEmpty],
description: t('Select the geojson column'),
- mapStateToProps: state => ({
+ mapStateToProps: (state: $TSFixMe) => ({
choices: columnChoices(state.datasource),
}),
},
diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/Bubble/index.js b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/Bubble/index.ts
similarity index 100%
rename from superset-frontend/plugins/legacy-preset-chart-nvd3/src/Bubble/index.js
rename to superset-frontend/plugins/legacy-preset-chart-nvd3/src/Bubble/index.ts
diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/Bullet/index.js b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/Bullet/index.ts
similarity index 100%
rename from superset-frontend/plugins/legacy-preset-chart-nvd3/src/Bullet/index.js
rename to superset-frontend/plugins/legacy-preset-chart-nvd3/src/Bullet/index.ts
diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/Compare/index.js b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/Compare/index.ts
similarity index 100%
rename from superset-frontend/plugins/legacy-preset-chart-nvd3/src/Compare/index.js
rename to superset-frontend/plugins/legacy-preset-chart-nvd3/src/Compare/index.ts
diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Vis.js b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Vis.ts
similarity index 86%
rename from superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Vis.js
rename to superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Vis.ts
index 0620103c7f..ad23205e02 100644
--- a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Vis.js
+++ b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Vis.ts
@@ -21,6 +21,7 @@ import { kebabCase, throttle } from 'lodash';
import d3 from 'd3';
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
+// @ts-expect-error TS(7016): Could not find a declaration file for module 'nvd3... Remove this comment to see the full error message
import nv from 'nvd3-fork';
import PropTypes from 'prop-types';
import {
@@ -85,7 +86,7 @@ const smartDateVerboseFormatter = getTimeFormatter(SMART_DATE_VERBOSE_ID);
// Override the noData render function to make a prettier UX
// Code adapted from https://github.com/novus/nvd3/blob/master/src/utils.js#L653
-nv.utils.noData = function noData(chart, container) {
+nv.utils.noData = function noData(chart: $TSFixMe, container: $TSFixMe) {
const opt = chart.options();
const margin = opt.margin();
const height = nv.utils.availableHeight(null, container, margin);
@@ -103,14 +104,14 @@ nv.utils.noData = function noData(chart, container) {
noDataText
.enter()
.append('text')
- .attr('class', d => `nvd3 nv-noData ${d.class}`)
- .attr('dy', d => d.dy)
+ .attr('class', (d: $TSFixMe) => `nvd3 nv-noData ${d.class}`)
+ .attr('dy', (d: $TSFixMe) => d.dy)
.style('text-anchor', 'middle');
noDataText
.attr('x', x)
.attr('y', y)
- .text(d => d.text);
+ .text((d: $TSFixMe) => d.text);
};
const { getColor, getScale } = CategoricalColorNamespace;
@@ -136,16 +137,19 @@ const propTypes = {
categoryAndValueXYType,
// dist-bar
PropTypes.shape({
+ // @ts-expect-error TS(2345): Argument of type '{ key: PropTypes.Requireable<str... Remove this comment to see the full error message
key: PropTypes.string,
values: PropTypes.arrayOf(categoryAndValueXYType),
}),
// area, line, compare, bar
PropTypes.shape({
+ // @ts-expect-error TS(2345): Argument of type '{ key: PropTypes.Requireable<(st... Remove this comment to see the full error message
key: PropTypes.arrayOf(PropTypes.string),
values: PropTypes.arrayOf(numericXYType),
}),
// dual-line
PropTypes.shape({
+ // @ts-expect-error TS(2345): Argument of type '{ classed: PropTypes.Requireable... Remove this comment to see the full error message
classed: PropTypes.string,
key: PropTypes.string,
type: PropTypes.string,
@@ -154,11 +158,13 @@ const propTypes = {
}),
// box-plot
PropTypes.shape({
+ // @ts-expect-error TS(2345): Argument of type '{ label: PropTypes.Requireable<s... Remove this comment to see the full error message
label: PropTypes.string,
values: PropTypes.arrayOf(boxPlotValueType),
}),
// bubble
PropTypes.shape({
+ // @ts-expect-error TS(2345): Argument of type '{ key: PropTypes.Requireable<str... Remove this comment to see the full error message
key: PropTypes.string,
values: PropTypes.arrayOf(PropTypes.object),
}),
@@ -233,7 +239,7 @@ const propTypes = {
const NOOP = () => {};
const formatter = getNumberFormatter();
-function nvd3Vis(element, props) {
+function nvd3Vis(element: $TSFixMe, props: $TSFixMe) {
const {
data,
width: maxWidth,
@@ -288,11 +294,13 @@ function nvd3Vis(element, props) {
const isExplore = document.querySelector('#explorer-container') !== null;
const container = element;
container.innerHTML = '';
- const activeAnnotationLayers = annotationLayers.filter(layer => layer.show);
+ const activeAnnotationLayers = annotationLayers.filter(
+ (layer: $TSFixMe) => layer.show,
+ );
// Search for the chart id in a parent div from the nvd3 chart
let chartContainer = container;
- let chartId = null;
+ let chartId: $TSFixMe = null;
while (chartContainer.parentElement) {
if (chartContainer.parentElement.id.startsWith(CHART_ID_PREFIX)) {
chartId = chartContainer.parentElement.id;
@@ -302,14 +310,14 @@ function nvd3Vis(element, props) {
chartContainer = chartContainer.parentElement;
}
- let chart;
+ let chart: $TSFixMe;
const width = maxWidth;
let colorKey = 'key';
container.style.width = `${maxWidth}px`;
container.style.height = `${maxHeight}px`;
- function isVizTypes(types) {
+ function isVizTypes(types: $TSFixMe) {
return types.includes(vizType);
}
@@ -366,25 +374,29 @@ function nvd3Vis(element, props) {
if (['key', 'value', 'percent'].includes(pieLabelType)) {
chart.labelType(pieLabelType);
} else if (pieLabelType === 'key_value') {
- chart.labelType(d => `${d.data.x}: ${numberFormatter(d.data.y)}`);
+ chart.labelType(
+ (d: $TSFixMe) => `${d.data.x}: ${numberFormatter(d.data.y)}`,
+ );
} else {
// pieLabelType in ['key_percent', 'key_value_percent']
- const total = d3.sum(data, d => d.y);
+ const total = d3.sum(data, (d: $TSFixMe) => d.y);
const percentFormatter = getNumberFormatter(
NumberFormats.PERCENT_2_POINT,
);
if (pieLabelType === 'key_percent') {
- chart.tooltip.valueFormatter(d => percentFormatter(d));
+ chart.tooltip.valueFormatter((d: $TSFixMe) => percentFormatter(d));
chart.labelType(
- d => `${d.data.x}: ${percentFormatter(d.data.y / total)}`,
+ (d: $TSFixMe) =>
+ `${d.data.x}: ${percentFormatter(d.data.y / total)}`,
);
} else {
// pieLabelType === 'key_value_percent'
chart.tooltip.valueFormatter(
- d => `${numberFormatter(d)} (${percentFormatter(d / total)})`,
+ (d: $TSFixMe) =>
+ `${numberFormatter(d)} (${percentFormatter(d / total)})`,
);
chart.labelType(
- d =>
+ (d: $TSFixMe) =>
`${d.data.x}: ${numberFormatter(d.data.y)} (${percentFormatter(
d.data.y / total,
)})`,
@@ -410,7 +422,7 @@ function nvd3Vis(element, props) {
chart = nv.models.scatterChart();
chart.showDistX(false);
chart.showDistY(false);
- chart.tooltip.contentGenerator(d =>
+ chart.tooltip.contentGenerator((d: $TSFixMe) =>
generateBubbleTooltipContent({
point: d.point,
entity,
@@ -425,14 +437,16 @@ function nvd3Vis(element, props) {
chart.pointRange([5, maxBubbleSize ** 2]);
chart.pointDomain([
0,
- d3.max(data, d => d3.max(d.values, v => v.size)),
+ d3.max(data, (d: $TSFixMe) =>
+ d3.max(d.values, (v: $TSFixMe) => v.size),
+ ),
]);
break;
case VizType.BoxPlot:
colorKey = 'label';
chart = nv.models.boxPlotChart();
- chart.x(d => d.label);
+ chart.x((d: $TSFixMe) => d.label);
chart.maxBoxWidth(75); // prevent boxes from being incredibly wide
break;
@@ -461,7 +475,7 @@ function nvd3Vis(element, props) {
if (canShowBrush && onBrushEnd !== NOOP) {
if (chart.focus) {
- chart.focus.dispatch.on('brush', event => {
+ chart.focus.dispatch.on('brush', (event: $TSFixMe) => {
const timeRange = stringifyTimeRange(event.extent);
if (timeRange) {
event.brush.on('brushend', () => {
@@ -500,7 +514,7 @@ function nvd3Vis(element, props) {
chart.xScale(d3.scale.log());
}
- let xAxisFormatter;
+ let xAxisFormatter: $TSFixMe;
if (isTimeSeries) {
xAxisFormatter = getTimeFormatter(xAxisFormat);
// In tooltips, always use the verbose time format
@@ -514,7 +528,7 @@ function nvd3Vis(element, props) {
if (chart.xAxis && chart.xAxis.tickFormat) {
const isXAxisString = isVizTypes([VizType.BoxPlot]);
if (isXAxisString) {
- chart.xAxis.tickFormat(d =>
+ chart.xAxis.tickFormat((d: $TSFixMe) =>
d.length > MAX_NO_CHARACTERS_IN_LABEL
? `${d.slice(0, Math.max(0, MAX_NO_CHARACTERS_IN_LABEL))}…`
: d,
@@ -558,7 +572,7 @@ function nvd3Vis(element, props) {
if (vizType === VizType.TimePivot) {
if (baseColor) {
const { r, g, b } = baseColor;
- chart.color(d => {
+ chart.color((d: $TSFixMe) => {
const alpha = d.rank > 0 ? d.perc * 0.5 : 1;
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
@@ -566,18 +580,19 @@ function nvd3Vis(element, props) {
}
chart.useInteractiveGuideline(true);
- chart.interactiveLayer.tooltip.contentGenerator(d =>
+ chart.interactiveLayer.tooltip.contentGenerator((d: $TSFixMe) =>
generateTimePivotTooltip(d, xAxisFormatter, yAxisFormatter),
);
} else if (vizType !== VizType.Bullet) {
const colorFn = getScale(colorScheme);
chart.color(
- d => d.color || colorFn(cleanColorInput(d[colorKey]), sliceId),
+ (d: $TSFixMe) =>
+ d.color || colorFn(cleanColorInput(d[colorKey]), sliceId),
);
}
if (isVizTypes([VizType.Compare])) {
- chart.interactiveLayer.tooltip.contentGenerator(d =>
+ chart.interactiveLayer.tooltip.contentGenerator((d: $TSFixMe) =>
generateCompareTooltipContent(d, yAxisFormatter),
);
}
@@ -596,7 +611,7 @@ function nvd3Vis(element, props) {
// For log scale, only show 1, 10, 100, 1000, ...
if (yIsLogScale) {
- chart.yAxis.tickFormat(d =>
+ chart.yAxis.tickFormat((d: $TSFixMe) =>
d !== 0 && Math.log10(d) % 1 === 0 ? yAxisFormatter(d) : '',
);
}
@@ -729,12 +744,14 @@ function nvd3Vis(element, props) {
// Time series annotations add additional data
const timeSeriesAnnotations = activeAnnotationLayers
.filter(
- layer => layer.annotationType === ANNOTATION_TYPES.TIME_SERIES,
+ (layer: $TSFixMe) =>
+ // @ts-expect-error TS(2339): Property 'TIME_SERIES' does not exist on type '{}'... Remove this comment to see the full error message
+ layer.annotationType === ANNOTATION_TYPES.TIME_SERIES,
)
.reduce(
- (bushel, a) =>
+ (bushel: $TSFixMe, a: $TSFixMe) =>
bushel.concat(
- (annotationData[a.name] || []).map(series => {
+ (annotationData[a.name] || []).map((series: $TSFixMe) => {
if (!series) {
return {};
}
@@ -791,12 +808,13 @@ function nvd3Vis(element, props) {
if (isTimeSeries && activeAnnotationLayers.length > 0) {
// Formula annotations
const formulas = activeAnnotationLayers.filter(
- a => a.annotationType === ANNOTATION_TYPES.FORMULA,
+ // @ts-expect-error TS(2339): Property 'FORMULA' does not exist on type '{}'.
+ (a: $TSFixMe) => a.annotationType === ANNOTATION_TYPES.FORMULA,
);
const xMax = chart.xAxis.scale().domain()[1].valueOf();
const xMin = chart.xAxis.scale().domain()[0].valueOf();
- let xScale;
+ let xScale: $TSFixMe;
if (chart.xScale) {
xScale = chart.xScale();
} else if (chart.xAxis.scale) {
@@ -809,10 +827,14 @@ function nvd3Vis(element, props) {
}
if (formulas.length > 0) {
- const xValues = [];
+ const xValues: $TSFixMe = [];
let period = Math.min(
- ...data.map(d =>
- Math.min(...d.values.slice(1).map((v, i) => v.x - d.values[i].x)),
+ ...data.map((d: $TSFixMe) =>
+ Math.min(
+ ...d.values
+ .slice(1)
+ .map((v: $TSFixMe, i: $TSFixMe) => v.x - d.values[i].x),
+ ),
),
);
const dataPoints = (xMax - xMin) / (period || 1);
@@ -825,10 +847,11 @@ function nvd3Vis(element, props) {
}
xValues.push(xMax);
- const formulaData = formulas.map(fo => {
+ const formulaData = formulas.map((fo: $TSFixMe) => {
const { value: expression } = fo;
return {
key: fo.name,
+ // @ts-expect-error TS(7006): Parameter 'x' implicitly has an 'any' type.
values: xValues.map(x => ({
x,
y: evalExpression(expression, x),
@@ -849,12 +872,13 @@ function nvd3Vis(element, props) {
// Event annotations
activeAnnotationLayers
.filter(
- x =>
+ (x: $TSFixMe) =>
+ // @ts-expect-error TS(2339): Property 'EVENT' does not exist on type '{}'.
x.annotationType === ANNOTATION_TYPES.EVENT &&
annotationData &&
annotationData[x.name],
)
- .forEach((config, index) => {
+ .forEach((config: $TSFixMe, index: $TSFixMe) => {
const e = applyNativeColumns(config);
// Add event annotation layer
const annotations = d3
@@ -870,7 +894,8 @@ function nvd3Vis(element, props) {
annotationTipClass: `arrow-down nv-event-annotation-layer-${config.sourceType}`,
});
const records = (annotationData[e.name].records || [])
- .map(r => {
+ .map((r: $TSFixMe) => {
+ // @ts-expect-error TS(2769): No overload matches this call.
const timeValue = new Date(dayjs.utc(r[e.timeColumn]));
return {
@@ -879,7 +904,7 @@ function nvd3Vis(element, props) {
};
})
.filter(
- record =>
+ (record: $TSFixMe) =>
!Number.isNaN(record[e.timeColumn].getMilliseconds()),
);
@@ -890,9 +915,9 @@ function nvd3Vis(element, props) {
.enter()
.append('line')
.attr({
- x1: d => xScale(new Date(d[e.timeColumn])),
+ x1: (d: $TSFixMe) => xScale(new Date(d[e.timeColumn])),
y1: 0,
- x2: d => xScale(new Date(d[e.timeColumn])),
+ x2: (d: $TSFixMe) => xScale(new Date(d[e.timeColumn])),
y2: annotationHeight,
})
.attr('class', `${e.opacity} ${e.style}`)
@@ -910,11 +935,11 @@ function nvd3Vis(element, props) {
.selectAll('line')
.data(records)
.attr({
- x1: d => xScale(new Date(d[e.timeColumn])),
+ x1: (d: $TSFixMe) => xScale(new Date(d[e.timeColumn])),
y1: 0,
- x2: d => xScale(new Date(d[e.timeColumn])),
+ x2: (d: $TSFixMe) => xScale(new Date(d[e.timeColumn])),
y2: annotationHeight,
- opacity: d => {
+ opacity: (d: $TSFixMe) => {
const x = xScale(new Date(d[e.timeColumn]));
return x > 0 && x < chartWidth ? 1 : 0;
@@ -927,12 +952,13 @@ function nvd3Vis(element, props) {
// Interval annotations
activeAnnotationLayers
.filter(
- x =>
+ (x: $TSFixMe) =>
+ // @ts-expect-error TS(2339): Property 'INTERVAL' does not exist on type '{}'.
x.annotationType === ANNOTATION_TYPES.INTERVAL &&
annotationData &&
annotationData[x.name],
)
- .forEach((config, index) => {
+ .forEach((config: $TSFixMe, index: $TSFixMe) => {
const e = applyNativeColumns(config);
// Add interval annotation layer
const annotations = d3
@@ -946,9 +972,11 @@ function nvd3Vis(element, props) {
const tip = tipFactory(e);
const records = (annotationData[e.name].records || [])
- .map(r => {
+ .map((r: $TSFixMe) => {
+ // @ts-expect-error TS(2769): No overload matches this call.
const timeValue = new Date(dayjs.utc(r[e.timeColumn]));
const intervalEndValue = new Date(
+ // @ts-expect-error TS(2769): No overload matches this call.
dayjs.utc(r[e.intervalEndColumn]),
);
@@ -959,7 +987,7 @@ function nvd3Vis(element, props) {
};
})
.filter(
- record =>
+ (record: $TSFixMe) =>
!Number.isNaN(record[e.timeColumn].getMilliseconds()) &&
!Number.isNaN(
record[e.intervalEndColumn].getMilliseconds(),
@@ -973,13 +1001,13 @@ function nvd3Vis(element, props) {
.enter()
.append('rect')
.attr({
- x: d =>
+ x: (d: $TSFixMe) =>
Math.min(
xScale(new Date(d[e.timeColumn])),
xScale(new Date(d[e.intervalEndColumn])),
),
y: 0,
- width: d =>
+ width: (d: $TSFixMe) =>
Math.max(
Math.abs(
xScale(new Date(d[e.intervalEndColumn])) -
@@ -1006,8 +1034,8 @@ function nvd3Vis(element, props) {
.selectAll('rect')
.data(records)
.attr({
- x: d => xScale(new Date(d[e.timeColumn])),
- width: d => {
+ x: (d: $TSFixMe) => xScale(new Date(d[e.timeColumn])),
+ width: (d: $TSFixMe) => {
const x1 = xScale(new Date(d[e.timeColumn]));
const x2 = xScale(new Date(d[e.intervalEndColumn]));
diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/PropTypes.js b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/PropTypes.ts
similarity index 100%
rename from superset-frontend/plugins/legacy-preset-chart-nvd3/src/PropTypes.js
rename to superset-frontend/plugins/legacy-preset-chart-nvd3/src/PropTypes.ts
diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/ReactNVD3.jsx b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/ReactNVD3.tsx
similarity index 97%
rename from superset-frontend/plugins/legacy-preset-chart-nvd3/src/ReactNVD3.jsx
rename to superset-frontend/plugins/legacy-preset-chart-nvd3/src/ReactNVD3.tsx
index 35cada7e4d..24c16cbf34 100644
--- a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/ReactNVD3.jsx
+++ b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/ReactNVD3.tsx
@@ -21,7 +21,7 @@ import PropTypes from 'prop-types';
import Component from './NVD3Vis';
import { hideTooltips, removeTooltip } from './utils';
-function componentWillUnmount() {
+function componentWillUnmount(this: $TSFixMe) {
const { id } = this.props;
if (id !== null && id !== undefined) {
removeTooltip(id);
@@ -32,7 +32,7 @@ function componentWillUnmount() {
const ReactNVD3 = reactify(Component, { componentWillUnmount });
-const NVD3 = ({ className, ...otherProps }) => (
+const NVD3 = ({ className, ...otherProps }: $TSFixMe) => (
<div className={className}>
<ReactNVD3 {...otherProps} />
</div>
diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/TimePivot/index.js b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/TimePivot/index.ts
similarity index 100%
rename from superset-frontend/plugins/legacy-preset-chart-nvd3/src/TimePivot/index.js
rename to superset-frontend/plugins/legacy-preset-chart-nvd3/src/TimePivot/index.ts
diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/index.js b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/index.ts
similarity index 100%
rename from superset-frontend/plugins/legacy-preset-chart-nvd3/src/index.js
rename to superset-frontend/plugins/legacy-preset-chart-nvd3/src/index.ts
diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/preset.js b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/preset.ts
similarity index 100%
rename from superset-frontend/plugins/legacy-preset-chart-nvd3/src/preset.js
rename to superset-frontend/plugins/legacy-preset-chart-nvd3/src/preset.ts
diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/transformProps.js b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/transformProps.ts
similarity index 93%
rename from superset-frontend/plugins/legacy-preset-chart-nvd3/src/transformProps.js
rename to superset-frontend/plugins/legacy-preset-chart-nvd3/src/transformProps.ts
index 36465e97a4..e44f40c4fc 100644
--- a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/transformProps.js
+++ b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/transformProps.ts
@@ -26,10 +26,10 @@ import { formatLabel } from './utils';
const NOOP = () => {};
-const grabD3Format = (datasource, targetMetric) => {
+const grabD3Format = (datasource: $TSFixMe, targetMetric: $TSFixMe) => {
let foundFormatter;
const { metrics = [] } = datasource || {};
- metrics.forEach(metric => {
+ metrics.forEach((metric: $TSFixMe) => {
if (metric.d3format && metric.metric_name === targetMetric) {
foundFormatter = metric.d3format;
}
@@ -38,7 +38,7 @@ const grabD3Format = (datasource, targetMetric) => {
return foundFormatter;
};
-export default function transformProps(chartProps) {
+export default function transformProps(chartProps: $TSFixMe) {
const {
width,
height,
@@ -112,7 +112,9 @@ export default function transformProps(chartProps) {
? rawData.map(row => ({
...row,
values: Array.isArray(row.values)
- ? row.values.map(value => ({ ...value }))
+ ? row.values.map((value: $TSFixMe) => ({
+ ...value,
+ }))
: row.values,
key: formatLabel(row.key, datasource.verboseMap),
}))
@@ -154,7 +156,7 @@ export default function transformProps(chartProps) {
maxBubbleSize: parseInt(maxBubbleSize, 10),
numberFormat,
onBrushEnd: isTruthy(sendTimeRange)
- ? timeRange => {
+ ? (timeRange: $TSFixMe) => {
onAddFilter('__time_range', timeRange, false, true);
}
: undefined,
diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/utils.js b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/utils.ts
similarity index 72%
rename from superset-frontend/plugins/legacy-preset-chart-nvd3/src/utils.js
rename to superset-frontend/plugins/legacy-preset-chart-nvd3/src/utils.ts
index dccc9e4184..319da4ca8a 100644
--- a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/utils.js
+++ b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/utils.ts
@@ -17,6 +17,7 @@
* under the License.
*/
import d3 from 'd3';
+// @ts-expect-error TS(7016): Could not find a declaration file for module 'd3-t... Remove this comment to see the full error message
import d3tip from 'd3-tip';
import dompurify from 'dompurify';
import {
@@ -30,7 +31,7 @@ const TIME_SHIFT_PATTERN = /\d+ \w+ offset/;
const ANIMATION_TIME = 1000;
-export function cleanColorInput(value) {
+export function cleanColorInput(value: $TSFixMe) {
// for superset series that should have the same color
return String(value)
.trim()
@@ -45,23 +46,28 @@ export function cleanColorInput(value) {
* Otherwise, format number with the given format name
* @param {*} format
*/
-export function getTimeOrNumberFormatter(format) {
+export function getTimeOrNumberFormatter(format: $TSFixMe) {
return format === SMART_DATE_ID
? getTimeFormatter(SMART_DATE_ID)
: getNumberFormatter(format);
}
-export function drawBarValues(svg, data, stacked, axisFormat) {
+export function drawBarValues(
+ svg: $TSFixMe,
+ data: $TSFixMe,
+ stacked: $TSFixMe,
+ axisFormat: $TSFixMe,
+) {
const format = getNumberFormatter(axisFormat);
- const countSeriesDisplayed = data.filter(d => !d.disabled).length;
+ const countSeriesDisplayed = data.filter((d: $TSFixMe) => !d.disabled).length;
const totalStackedValues =
stacked && data.length !== 0
- ? data[0].values.map((bar, iBar) => {
+ ? data[0].values.map((bar: $TSFixMe, iBar: $TSFixMe) => {
const bars = data
- .filter(series => !series.disabled)
- .map(series => series.values[iBar]);
+ .filter((series: $TSFixMe) => !series.disabled)
+ .map((series: $TSFixMe) => series.values[iBar]);
- return d3.sum(bars, d => d.y);
+ return d3.sum(bars, (d: $TSFixMe) => d.y);
})
: [];
svg.selectAll('.bar-chart-label-group').remove();
@@ -73,9 +79,12 @@ export function drawBarValues(svg, data, stacked, axisFormat) {
.attr('class', 'bar-chart-label-group');
svg
.selectAll('g.nv-group')
- .filter((d, i) => !stacked || i === countSeriesDisplayed - 1)
+ .filter(
+ (d: $TSFixMe, i: $TSFixMe) =>
+ !stacked || i === countSeriesDisplayed - 1,
+ )
.selectAll('rect')
- .each(function each(d, index) {
+ .each(function each(this: $TSFixMe, d: $TSFixMe, index: $TSFixMe) {
const rectObj = d3.select(this);
const transformAttr = rectObj.attr('transform');
const xPos = parseFloat(rectObj.attr('x'));
@@ -103,7 +112,7 @@ export function drawBarValues(svg, data, stacked, axisFormat) {
}
// Formats the series key to account for a possible NULL value
-function getFormattedKey(seriesKey, shouldDompurify) {
+function getFormattedKey(seriesKey: $TSFixMe, shouldDompurify: $TSFixMe) {
if (seriesKey === '<NULL>') {
return `<${seriesKey.slice(1, -1)}>`;
}
@@ -111,14 +120,17 @@ function getFormattedKey(seriesKey, shouldDompurify) {
return shouldDompurify ? dompurify.sanitize(seriesKey) : seriesKey;
}
-export function generateCompareTooltipContent(d, valueFormatter) {
+export function generateCompareTooltipContent(
+ d: $TSFixMe,
+ valueFormatter: $TSFixMe,
+) {
let tooltip = '';
tooltip +=
"<table><thead><tr><td colspan='3'>" +
`<strong class='x-value'>${d.value}</strong>` +
'</td></tr></thead><tbody>';
- d.series.sort((a, b) => (a.value >= b.value ? -1 : 1));
- d.series.forEach(series => {
+ d.series.sort((a: $TSFixMe, b: $TSFixMe) => (a.value >= b.value ? -1 : 1));
+ d.series.forEach((series: $TSFixMe) => {
const key = getFormattedKey(series.key, true);
tooltip +=
`<tr class="${series.highlight ? 'emph' : ''}">` +
@@ -140,7 +152,11 @@ export function generateCompareTooltipContent(d, valueFormatter) {
return dompurify.sanitize(tooltip);
}
-export function generateMultiLineTooltipContent(d, xFormatter, yFormatters) {
+export function generateMultiLineTooltipContent(
+ d: $TSFixMe,
+ xFormatter: $TSFixMe,
+ yFormatters: $TSFixMe,
+) {
const tooltipTitle = xFormatter(d.value);
let tooltip = '';
@@ -149,7 +165,7 @@ export function generateMultiLineTooltipContent(d, xFormatter, yFormatters) {
`<strong class='x-value'>${tooltipTitle}</strong>` +
'</td></tr></thead><tbody>';
- d.series.forEach((series, i) => {
+ d.series.forEach((series: $TSFixMe, i: $TSFixMe) => {
const yFormatter = yFormatters[i];
const key = getFormattedKey(series.key, false);
tooltip +=
@@ -164,7 +180,11 @@ export function generateMultiLineTooltipContent(d, xFormatter, yFormatters) {
return tooltip;
}
-export function generateTimePivotTooltip(d, xFormatter, yFormatter) {
+export function generateTimePivotTooltip(
+ d: $TSFixMe,
+ xFormatter: $TSFixMe,
+ yFormatter: $TSFixMe,
+) {
const tooltipTitle = xFormatter(d.value);
let tooltip = '';
@@ -173,7 +193,7 @@ export function generateTimePivotTooltip(d, xFormatter, yFormatter) {
`<strong class='x-value'>${tooltipTitle}</strong>` +
'</td></tr></thead><tbody>';
- d.series.forEach(series => {
+ d.series.forEach((series: $TSFixMe) => {
if (series.highlight) {
let label = '';
if (series.key === 'current') {
@@ -194,11 +214,11 @@ export function generateTimePivotTooltip(d, xFormatter, yFormatter) {
return dompurify.sanitize(tooltip);
}
-function getLabel(stringOrObjectWithLabel) {
+function getLabel(stringOrObjectWithLabel: $TSFixMe) {
return stringOrObjectWithLabel.label || stringOrObjectWithLabel;
}
-function createHTMLRow(col1, col2) {
+function createHTMLRow(col1: $TSFixMe, col2: $TSFixMe) {
return `<tr><td>${col1}</td><td>${col2}</td></tr>`;
}
@@ -211,7 +231,7 @@ export function generateBubbleTooltipContent({
xFormatter,
yFormatter,
sizeFormatter,
-}) {
+}: $TSFixMe) {
let s = '<table>';
s +=
`<tr><td style="color: ${point.color};">` +
@@ -226,7 +246,7 @@ export function generateBubbleTooltipContent({
}
// shouldRemove indicates whether the nvtooltips should be removed from the DOM
-export function hideTooltips(shouldRemove) {
+export function hideTooltips(shouldRemove: $TSFixMe) {
const targets = document.querySelectorAll('.nvtooltip');
if (targets.length > 0) {
// Only set opacity to 0 when hiding tooltips so they would reappear
@@ -235,6 +255,7 @@ export function hideTooltips(shouldRemove) {
if (shouldRemove) {
t.remove();
} else {
+ // @ts-expect-error TS(2339): Property 'style' does not exist on type 'Element'.
// eslint-disable-next-line no-param-reassign
t.style.opacity = 0;
}
@@ -242,11 +263,11 @@ export function hideTooltips(shouldRemove) {
}
}
-export function generateTooltipClassName(uuid) {
+export function generateTooltipClassName(uuid: $TSFixMe) {
return `tooltip-${uuid}`;
}
-export function removeTooltip(uuid) {
+export function removeTooltip(uuid: $TSFixMe) {
const classSelector = `.${generateTooltipClassName(uuid)}`;
const target = document.querySelector(classSelector);
if (target) {
@@ -254,13 +275,13 @@ export function removeTooltip(uuid) {
}
}
-export function wrapTooltip(chart) {
+export function wrapTooltip(chart: $TSFixMe) {
const tooltipLayer =
chart.useInteractiveGuideline && chart.useInteractiveGuideline()
? chart.interactiveLayer
: chart;
const tooltipGeneratorFunc = tooltipLayer.tooltip.contentGenerator();
- tooltipLayer.tooltip.contentGenerator(d => {
+ tooltipLayer.tooltip.contentGenerator((d: $TSFixMe) => {
let tooltip = `<div>`;
tooltip += tooltipGeneratorFunc(d);
tooltip += '</div>';
@@ -269,12 +290,12 @@ export function wrapTooltip(chart) {
});
}
-export function tipFactory(layer) {
+export function tipFactory(layer: $TSFixMe) {
return d3tip()
.attr('class', `d3-tip ${layer.annotationTipClass || ''}`)
.direction('n')
.offset([-5, 0])
- .html(d => {
+ .html((d: $TSFixMe) => {
if (!d) {
return '';
}
@@ -283,7 +304,7 @@ export function tipFactory(layer) {
? `${d[layer.titleColumn]} - ${layer.name}`
: layer.name;
const body = Array.isArray(layer.descriptionColumns)
- ? layer.descriptionColumns.map(c => d[c])
+ ? layer.descriptionColumns.map((c: $TSFixMe) => d[c])
: Object.values(d);
return `<div><strong>${title}</strong></div><br/><div>${body.join(
@@ -292,12 +313,14 @@ export function tipFactory(layer) {
});
}
-export function getMaxLabelSize(svg, axisClass) {
+export function getMaxLabelSize(svg: $TSFixMe, axisClass: $TSFixMe) {
// axis class = .nv-y2 // second y axis on dual line chart
// axis class = .nv-x // x axis on time series line chart
const tickTexts = svg.selectAll(`.${axisClass} g.tick text`);
if (tickTexts.length > 0) {
- const lengths = tickTexts[0].map(text => text.getComputedTextLength());
+ const lengths = tickTexts[0].map((text: $TSFixMe) =>
+ text.getComputedTextLength(),
+ );
return Math.ceil(Math.max(0, ...lengths));
}
@@ -305,10 +328,11 @@ export function getMaxLabelSize(svg, axisClass) {
return 0;
}
-export function formatLabel(input, verboseMap = {}) {
+export function formatLabel(input: $TSFixMe, verboseMap = {}) {
// The input for label may be a string or an array of string
// When using the time shift feature, the label contains a '---' in the array
- const verboseLookup = s => verboseMap[s] || s;
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
+ const verboseLookup = (s: $TSFixMe) => verboseMap[s] || s;
return Array.isArray(input) && input.length > 0
? input
@@ -317,26 +341,28 @@ export function formatLabel(input, verboseMap = {}) {
: verboseLookup(input);
}
-export function stringifyTimeRange(extent) {
- if (extent.some(d => d.toISOString === undefined)) {
+export function stringifyTimeRange(extent: $TSFixMe) {
+ if (extent.some((d: $TSFixMe) => d.toISOString === undefined)) {
return null;
}
- return extent.map(d => d.toISOString().slice(0, -1)).join(' : ');
+ return extent.map((d: $TSFixMe) => d.toISOString().slice(0, -1)).join(' : ');
}
-export function setAxisShowMaxMin(axis, showminmax) {
+export function setAxisShowMaxMin(axis: $TSFixMe, showminmax: $TSFixMe) {
if (axis && axis.showMaxMin && showminmax !== undefined) {
axis.showMaxMin(showminmax);
}
}
-export function computeYDomain(data) {
+export function computeYDomain(data: $TSFixMe) {
if (Array.isArray(data) && data.length > 0 && Array.isArray(data[0].values)) {
const extents = data
.filter(d => !d.disabled)
- .map(row => d3.extent(row.values, v => v.y));
+ .map(row => d3.extent(row.values, (v: $TSFixMe) => v.y));
+ // @ts-expect-error TS(7031): Binding element 'min' implicitly has an 'any' type... Remove this comment to see the full error message
const minOfMin = d3.min(extents, ([min]) => min);
+ // @ts-expect-error TS(7031): Binding element 'max' implicitly has an 'any' type... Remove this comment to see the full error message
const maxOfMax = d3.max(extents, ([, max]) => max);
return [minOfMin, maxOfMax];
diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/utils/isTruthy.js b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/utils/isTruthy.ts
similarity index 95%
rename from superset-frontend/plugins/legacy-preset-chart-nvd3/src/utils/isTruthy.js
rename to superset-frontend/plugins/legacy-preset-chart-nvd3/src/utils/isTruthy.ts
index 2594a63633..fe03f14b81 100644
--- a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/utils/isTruthy.js
+++ b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/utils/isTruthy.ts
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-export default function isTruthy(obj) {
+export default function isTruthy(obj: $TSFixMe) {
if (typeof obj === 'boolean') {
return obj;
}
diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/vendor/superset/AnnotationTypes.js b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/vendor/superset/AnnotationTypes.ts
similarity index 81%
rename from superset-frontend/plugins/legacy-preset-chart-nvd3/src/vendor/superset/AnnotationTypes.js
rename to superset-frontend/plugins/legacy-preset-chart-nvd3/src/vendor/superset/AnnotationTypes.ts
index 6a91617c5a..886b6d7ad5 100644
--- a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/vendor/superset/AnnotationTypes.js
+++ b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/vendor/superset/AnnotationTypes.ts
@@ -18,9 +18,10 @@
*/
import { t } from '@superset-ui/core';
-function extractTypes(metadata) {
+function extractTypes(metadata: $TSFixMe) {
return Object.keys(metadata).reduce((prev, key) => {
const result = prev;
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
result[key] = key;
return result;
@@ -50,6 +51,7 @@ export const ANNOTATION_TYPES_METADATA = {
export const ANNOTATION_TYPES = extractTypes(ANNOTATION_TYPES_METADATA);
+// @ts-expect-error TS(2339): Property 'FORMULA' does not exist on type '{}'.
export const DEFAULT_ANNOTATION_TYPE = ANNOTATION_TYPES.FORMULA;
export const ANNOTATION_SOURCE_TYPES_METADATA = {
@@ -63,7 +65,7 @@ export const ANNOTATION_SOURCE_TYPES = extractTypes(
ANNOTATION_SOURCE_TYPES_METADATA,
);
-export function requiresQuery(annotationSourceType) {
+export function requiresQuery(annotationSourceType: $TSFixMe) {
return !!annotationSourceType;
}
@@ -74,7 +76,8 @@ const NATIVE_COLUMN_NAMES = {
titleColumn: 'short_descr',
};
-export function applyNativeColumns(annotation) {
+export function applyNativeColumns(annotation: $TSFixMe) {
+ // @ts-expect-error TS(2339): Property 'NATIVE' does not exist on type '{}'.
if (annotation.sourceType === ANNOTATION_SOURCE_TYPES.NATIVE) {
return { ...annotation, ...NATIVE_COLUMN_NAMES };
}
diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/vendor/superset/exploreUtils.js b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/vendor/superset/exploreUtils.ts
similarity index 83%
rename from superset-frontend/plugins/legacy-preset-chart-nvd3/src/vendor/superset/exploreUtils.js
rename to superset-frontend/plugins/legacy-preset-chart-nvd3/src/vendor/superset/exploreUtils.ts
index c4c9c3264e..b52fe4e29e 100644
--- a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/vendor/superset/exploreUtils.js
+++ b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/vendor/superset/exploreUtils.ts
@@ -22,7 +22,7 @@ import safeStringify from 'fast-safe-stringify';
const MAX_URL_LENGTH = 8000;
-export function getURIDirectory(formData, endpointType = 'base') {
+export function getURIDirectory(formData: $TSFixMe, endpointType = 'base') {
// Building the directory part of the URI
let directory = '/explore/';
if (['json', 'csv', 'query', 'results', 'samples'].includes(endpointType)) {
@@ -32,9 +32,10 @@ export function getURIDirectory(formData, endpointType = 'base') {
return directory;
}
+// @ts-expect-error TS(7023): 'getExploreLongUrl' implicitly has return type 'an... Remove this comment to see the full error message
export function getExploreLongUrl(
- formData,
- endpointType,
+ formData: $TSFixMe,
+ endpointType: $TSFixMe,
allowOverflow = true,
extraSearch = {},
) {
@@ -46,6 +47,7 @@ export function getExploreLongUrl(
const directory = getURIDirectory(formData, endpointType);
const search = uri.search(true);
Object.keys(extraSearch).forEach(key => {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
search[key] = extraSearch[key];
});
search.form_data = safeStringify(formData);
diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/test/utils.test.js b/superset-frontend/plugins/legacy-preset-chart-nvd3/test/utils.test.ts
similarity index 95%
rename from superset-frontend/plugins/legacy-preset-chart-nvd3/test/utils.test.js
rename to superset-frontend/plugins/legacy-preset-chart-nvd3/test/utils.test.ts
index 137a20e625..df8725f494 100644
--- a/superset-frontend/plugins/legacy-preset-chart-nvd3/test/utils.test.js
+++ b/superset-frontend/plugins/legacy-preset-chart-nvd3/test/utils.test.ts
@@ -128,10 +128,12 @@ describe('nvd3/utils', () => {
});
it('returns a date formatter if format is smart_date', () => {
const time = new Date(Date.UTC(2018, 10, 21, 22, 11));
+ // @ts-expect-error TS(2345): Argument of type 'Date' is not assignable to param... Remove this comment to see the full error message
expect(getTimeOrNumberFormatter('smart_date')(time)).toBe('10:11');
});
it('returns a number formatter otherwise', () => {
expect(getTimeOrNumberFormatter('.3s')(3000000)).toBe('3.00M');
+ // @ts-expect-error TS(2554): Expected 1 arguments, but got 0.
expect(getTimeOrNumberFormatter()(3000100)).toBe('3M');
});
});
diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/test/utils/isTruthy.test.js b/superset-frontend/plugins/legacy-preset-chart-nvd3/test/utils/isTruthy.test.ts
similarity index 100%
rename from superset-frontend/plugins/legacy-preset-chart-nvd3/test/utils/isTruthy.test.js
rename to superset-frontend/plugins/legacy-preset-chart-nvd3/test/utils/isTruthy.test.ts
diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/test/utils/tokenize.test.js b/superset-frontend/plugins/legacy-preset-chart-nvd3/test/utils/tokenize.test.ts
similarity index 100%
rename from superset-frontend/plugins/legacy-preset-chart-nvd3/test/utils/tokenize.test.js
rename to superset-frontend/plugins/legacy-preset-chart-nvd3/test/utils/tokenize.test.ts
diff --git a/superset-frontend/plugins/plugin-chart-cartodiagram/src/util/layerUtil.tsx b/superset-frontend/plugins/plugin-chart-cartodiagram/src/util/layerUtil.tsx
index 65e608bd75..4af5066efc 100644
--- a/superset-frontend/plugins/plugin-chart-cartodiagram/src/util/layerUtil.tsx
+++ b/superset-frontend/plugins/plugin-chart-cartodiagram/src/util/layerUtil.tsx
@@ -133,7 +133,6 @@ export const createWfsLayer = async (wfsLayerConf: WfsLayerConf) => {
return new VectorLayer({
source: wfsSource,
- // @ts-ignore
style: writeStyleResult?.output,
});
};
diff --git a/superset-frontend/plugins/plugin-chart-cartodiagram/test/util/layerUtil.test.ts b/superset-frontend/plugins/plugin-chart-cartodiagram/test/util/layerUtil.test.ts
index d2912105e0..2727cab0aa 100644
--- a/superset-frontend/plugins/plugin-chart-cartodiagram/test/util/layerUtil.test.ts
+++ b/superset-frontend/plugins/plugin-chart-cartodiagram/test/util/layerUtil.test.ts
@@ -72,10 +72,10 @@ describe('layerUtil', () => {
const wfsLayer = await createWfsLayer(wfsLayerConf);
const style = wfsLayer!.getStyle();
- // @ts-ignore
+ // @ts-expect-error TS(2339): Property 'length' does not exist on type 'StyleLik... Remove this comment to see the full error message
expect(style!.length).toEqual(3);
- // @ts-ignore upgrade `ol` package for better type of StyleLike type.
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
const colorAtLayer = style![1].getImage().getFill().getColor();
expect(colorToExpect).toEqual(colorAtLayer);
});
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberViz.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberViz.tsx
index 3fbb302b87..3a494da92f 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberViz.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberViz.tsx
@@ -207,7 +207,7 @@ class BigNumberVis extends PureComponent<BigNumberVizProps, BigNumberVisState> {
renderHeader(maxHeight: number) {
const { bigNumber, headerFormatter, width, colorThresholdFormatters } =
this.props;
- // @ts-ignore
+ // @ts-expect-error TS(2345): Argument of type 'string | number | bigint | boole... Remove this comment to see the full error message
const text = bigNumber === null ? t('No data') : headerFormatter(bigNumber);
const hasThresholdColorFormatter =
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/transformProps.ts b/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/transformProps.ts
index 79c5b992b3..5c3a3dec6f 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/transformProps.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/transformProps.ts
@@ -172,7 +172,7 @@ export default function transformProps(
if (data.length > 0) {
const reversedData = [...sortedData].reverse();
- // @ts-ignore
+ // @ts-expect-error TS(2322): Type '[number | null, number | null][] | undefined... Remove this comment to see the full error message
trendLineData = showTrendLine ? reversedData : undefined;
}
@@ -301,7 +301,7 @@ export default function transformProps(
width,
height,
bigNumber,
- // @ts-ignore
+ // @ts-expect-error TS(2322): Type '[number | null, number | null] | null | unde... Remove this comment to see the full error message
bigNumberFallback,
className,
headerFormatter,
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/transformProps.ts b/superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/transformProps.ts
index 511d083d47..d6223149e5 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/transformProps.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/transformProps.ts
@@ -201,7 +201,7 @@ export default function transformProps(
tooltip: {
...getDefaultTooltip(refs),
formatter: (param: CallbackDataParams) => {
- // @ts-ignore
+ // @ts-expect-error TS(2322): Type 'CallbackDataParams' is not assignable to typ... Remove this comment to see the full error message
const {
value,
name,
@@ -238,7 +238,7 @@ export default function transformProps(
},
},
},
- // @ts-ignore
+ // @ts-expect-error TS(2322): Type '{ name: string; type: string; data: (string ... Remove this comment to see the full error message
...outlierData,
];
const addYAxisTitleOffset = !!yAxisTitle;
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/types.ts b/superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/types.ts
index ecb22764cf..d80217c776 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/types.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/types.ts
@@ -47,7 +47,7 @@ export type BoxPlotFormXTickLayout =
| 'flat'
| 'staggered';
-// @ts-ignore
+// @ts-expect-error TS(2322): Type '{ xAxisTitle: string; xAxisTitleMargin: numb... Remove this comment to see the full error message
export const DEFAULT_FORM_DATA: BoxPlotQueryFormData = {
...DEFAULT_TITLE_FORM_DATA,
};
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/transformProps.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/transformProps.ts
index ff5a97c348..c06aeac68f 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/transformProps.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/transformProps.ts
@@ -254,7 +254,6 @@ export default function transformProps(
fontWeight: 'bold',
},
},
- // @ts-ignore
data: transformedData,
},
];
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/types.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/types.ts
index 18a40267cf..282f1bf951 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/types.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/types.ts
@@ -60,7 +60,7 @@ export interface EchartsFunnelChartProps
formData: EchartsFunnelFormData;
}
-// @ts-ignore
+// @ts-expect-error TS(2322): Type '{ groupby: never[]; labelLine: false; labelT... Remove this comment to see the full error message
export const DEFAULT_FORM_DATA: EchartsFunnelFormData = {
...DEFAULT_LEGEND_FORM_DATA,
groupby: [],
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Gauge/transformProps.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Gauge/transformProps.ts
index 29dcafc45b..4c1287059d 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Gauge/transformProps.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Gauge/transformProps.ts
@@ -332,7 +332,6 @@ export default function transformProps(
axisTick,
pointer,
detail,
- // @ts-ignore
tooltip,
radius:
Math.min(width, height) / 2 - axisLabelDistance - axisTickDistance,
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Graph/types.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Graph/types.ts
index 2c7deae3f6..1dc6dc2cfd 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Graph/types.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Graph/types.ts
@@ -59,7 +59,7 @@ export type EChartGraphNode = Omit<GraphNodeItemOption, 'value'> & {
tooltip?: Pick<SeriesTooltipOption, 'formatter'>;
};
-// @ts-ignore
+// @ts-expect-error TS(2322): Type '{ source: string; target: string; layout: "f... Remove this comment to see the full error message
export const DEFAULT_FORM_DATA: EchartsGraphFormData = {
...DEFAULT_LEGEND_FORM_DATA,
source: '',
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/EchartsMixedTimeseries.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/EchartsMixedTimeseries.tsx
index c3fda189c7..8e6e517780 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/EchartsMixedTimeseries.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/EchartsMixedTimeseries.tsx
@@ -75,7 +75,6 @@ export default function EchartsMixedTimeseries({
return {
dataMask: {
extraFormData: {
- // @ts-ignore
filters:
values.length === 0
? []
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/index.ts b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/index.ts
index 5d8eee2e57..ce3e16bf2e 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/index.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/index.ts
@@ -78,7 +78,6 @@ export default class EchartsTimeseriesChartPlugin extends EchartsChartPlugin<
],
queryObjectCount: 2,
},
- // @ts-ignore
transformProps,
});
}
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts
index 478915cfce..ba0f4d4ece 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts
@@ -675,7 +675,6 @@ export default function transformProps(
theme,
zoomable,
),
- // @ts-ignore
data: rawSeriesA
.concat(rawSeriesB)
.filter(
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/types.ts b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/types.ts
index e79523d176..fc7519ca9b 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/types.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/types.ts
@@ -90,7 +90,7 @@ export type EchartsMixedTimeseriesFormData = QueryFormData & {
} & LegendFormData &
TitleFormData;
-// @ts-ignore
+// @ts-expect-error TS(2322): Type '{ xAxisTitle: string; xAxisTitleMargin: numb... Remove this comment to see the full error message
export const DEFAULT_FORM_DATA: EchartsMixedTimeseriesFormData = {
...DEFAULT_LEGEND_FORM_DATA,
annotationLayers: [],
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Pie/types.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Pie/types.ts
index c684dcf457..545c244092 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Pie/types.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Pie/types.ts
@@ -66,7 +66,7 @@ export interface EchartsPieChartProps
formData: EchartsPieFormData;
}
-// @ts-ignore
+// @ts-expect-error TS(2322): Type '{ donut: false; groupby: never[]; innerRadiu... Remove this comment to see the full error message
export const DEFAULT_FORM_DATA: EchartsPieFormData = {
...DEFAULT_LEGEND_FORM_DATA,
donut: false,
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Radar/types.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Radar/types.ts
index 0f335683fe..a41ee860f1 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Radar/types.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Radar/types.ts
@@ -66,7 +66,7 @@ export interface EchartsRadarChartProps
formData: EchartsRadarFormData;
}
-// @ts-ignore
+// @ts-expect-error TS(2322): Type '{ groupby: never[]; labelType: EchartsRadarL... Remove this comment to see the full error message
export const DEFAULT_FORM_DATA: EchartsRadarFormData = {
...DEFAULT_LEGEND_FORM_DATA,
groupby: [],
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx
index b91db0b4c1..6f7817b16f 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx
@@ -240,7 +240,7 @@ export default function EchartsTimeseries({
if (echartInstance?.containPixel('grid', pointInPixel)) {
// do not trigger if click unstacked chart's blank area
if (!stack && params.target?.type === 'ec-polygon') return;
- // @ts-ignore
+ // @ts-expect-error TS(2341): Property 'getModel' is private and only accessible... Remove this comment to see the full error message
const globalModel = echartInstance.getModel();
const model = getModelInfo(params.target, globalModel);
if (model) {
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/constants.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/constants.ts
index 32e8d876aa..00b76228e7 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/constants.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/constants.ts
@@ -33,7 +33,7 @@ import {
// } from '../constants';
import { defaultXAxis } from '../defaults';
-// @ts-ignore
+// @ts-expect-error TS(2322): Type '{ annotationLayers: never[]; area: false; fo... Remove this comment to see the full error message
export const DEFAULT_FORM_DATA: EchartsTimeseriesFormData = {
// ...DEFAULT_LEGEND_FORM_DATA, // TODO: figure out why these break things for stories (e.g. Bubble Chart)
// Here are the contents of DEFAULT_LEGEND_FORM_DATA:
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts
index 0abefc95e3..41001b4a88 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts
@@ -295,11 +295,11 @@ export function transformSeries(
yAxisIndex,
name: forecastSeries.name,
itemStyle,
- // @ts-ignore
+ // @ts-expect-error TS(2322): Type 'string' is not assignable to type '"line"'.
type: plotType,
smooth: seriesType === 'smooth',
triggerLineEvent: true,
- // @ts-ignore
+ // @ts-expect-error TS(2322): Type 'EchartsTimeseriesSeriesType | undefined' is ... Remove this comment to see the full error message
step: ['start', 'middle', 'end'].includes(seriesType as string)
? seriesType
: undefined,
@@ -426,7 +426,7 @@ export function transformIntervalAnnotation(
position: 'insideTop',
verticalAlign: 'top',
fontWeight: 'bold',
- // @ts-ignore
+ // @ts-expect-error TS(2322): Type '{ show: true; color: string; position: "insi... Remove this comment to see the full error message
emphasis: {
position: 'insideTop',
verticalAlign: 'top',
@@ -436,7 +436,6 @@ export function transformIntervalAnnotation(
: {
show: false,
color: theme.colors.grayscale.dark2,
- // @ts-ignore
emphasis: {
fontWeight: 'bold',
show: true,
@@ -507,7 +506,7 @@ export function transformEventAnnotation(
position: 'insideEndTop',
fontWeight: 'bold',
formatter: (params: CallbackDataParams) => params.name,
- // @ts-ignore
+ // @ts-expect-error TS(2322): Type '{ show: true; color: string; position: "insi... Remove this comment to see the full error message
emphasis: {
backgroundColor: theme.colors.grayscale.light5,
},
@@ -516,7 +515,6 @@ export function transformEventAnnotation(
show: false,
color: theme.colors.grayscale.dark2,
position: 'insideEndTop',
- // @ts-ignore
emphasis: {
formatter: (params: CallbackDataParams) => params.name,
fontWeight: 'bold',
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/BigNumber/transformProps.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/BigNumber/transformProps.test.ts
index e7ce20cc07..538f806e63 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/BigNumber/transformProps.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/BigNumber/transformProps.test.ts
@@ -133,7 +133,7 @@ describe('BigNumberWithTrendline', () => {
expect(transformed.bigNumberFallback).not.toBeNull();
// should successfully formatTime by granularity
- // @ts-ignore
+ // @ts-expect-error TS(2722): Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
expect(transformed.formatTime(new Date('2020-01-01'))).toStrictEqual(
'2020-01-01 00:00:00',
);
@@ -155,7 +155,7 @@ describe('BigNumberWithTrendline', () => {
},
};
const transformed = transformProps(propsWithDatasource);
- // @ts-ignore
+ // @ts-expect-error TS(2345): Argument of type 'DataRecordValue | undefined' is ... Remove this comment to see the full error message
expect(transformed.headerFormatter(transformed.bigNumber)).toStrictEqual(
'1.23',
);
@@ -181,7 +181,7 @@ describe('BigNumberWithTrendline', () => {
},
};
const transformed = transformProps(propsWithDatasource);
- // @ts-ignore
+ // @ts-expect-error TS(2345): Argument of type 'DataRecordValue | undefined' is ... Remove this comment to see the full error message
expect(transformed.headerFormatter(transformed.bigNumber)).toStrictEqual(
'$ 1.23',
);
diff --git a/superset-frontend/plugins/plugin-chart-pivot-table/src/PivotTableChart.tsx b/superset-frontend/plugins/plugin-chart-pivot-table/src/PivotTableChart.tsx
index 66f0b9429c..31e492b3d9 100644
--- a/superset-frontend/plugins/plugin-chart-pivot-table/src/PivotTableChart.tsx
+++ b/superset-frontend/plugins/plugin-chart-pivot-table/src/PivotTableChart.tsx
@@ -541,6 +541,7 @@ export default function PivotTableChart(props: PivotTableProps) {
<Styles height={height} width={width} margin={theme.sizeUnit * 4}>
<PivotTableWrapper>
<PivotTable
+ // @ts-expect-error TS(2769): No overload matches this call.
data={unpivotedData}
rows={rows}
cols={cols}
diff --git a/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/PivotTable.jsx b/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/PivotTable.tsx
similarity index 80%
rename from superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/PivotTable.jsx
rename to superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/PivotTable.tsx
index aa8fbe4f5b..f3623d0125 100644
--- a/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/PivotTable.jsx
+++ b/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/PivotTable.tsx
@@ -26,7 +26,9 @@ class PivotTable extends PureComponent {
}
}
+// @ts-expect-error TS(2339): Property 'propTypes' does not exist on type 'typeo... Remove this comment to see the full error message
PivotTable.propTypes = TableRenderer.propTypes;
+// @ts-expect-error TS(2339): Property 'defaultProps' does not exist on type 'ty... Remove this comment to see the full error message
PivotTable.defaultProps = TableRenderer.defaultProps;
export default PivotTable;
diff --git a/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/Styles.js b/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/Styles.ts
similarity index 96%
rename from superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/Styles.js
rename to superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/Styles.ts
index ceec36621c..e9390aa008 100644
--- a/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/Styles.js
+++ b/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/Styles.ts
@@ -20,6 +20,7 @@
import { css, styled } from '@superset-ui/core';
export const Styles = styled.div`
+ // @ts-expect-error TS(2339): Property 'isDashboardEditMode' does not exist on t... Remove this comment to see the full error message
${({ theme, isDashboardEditMode }) => css`
table.pvtTable {
position: ${isDashboardEditMode ? 'inherit' : 'relative'};
diff --git a/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.jsx b/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.tsx
similarity index 69%
rename from superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.jsx
rename to superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.tsx
index 06085a42ad..d5e0a21208 100644
--- a/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.jsx
+++ b/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.tsx
@@ -23,7 +23,7 @@ import PropTypes from 'prop-types';
import { PivotData, flatKey } from './utilities';
import { Styles } from './Styles';
-const parseLabel = value => {
+const parseLabel = (value: $TSFixMe) => {
if (typeof value === 'string') {
if (value === 'metric') return t('metric');
return value;
@@ -35,12 +35,12 @@ const parseLabel = value => {
};
function displayHeaderCell(
- needToggle,
- ArrowIcon,
- onArrowClick,
- value,
- namesMapping,
- allowRenderHtml,
+ needToggle: $TSFixMe,
+ ArrowIcon: $TSFixMe,
+ onArrowClick: $TSFixMe,
+ value: $TSFixMe,
+ namesMapping: $TSFixMe,
+ allowRenderHtml: $TSFixMe,
) {
const name = namesMapping[value] || value;
const parsedLabel = parseLabel(name);
@@ -52,6 +52,7 @@ function displayHeaderCell(
<span className="toggle-wrapper">
<span
role="button"
+ // @ts-expect-error TS(2322): Type 'string' is not assignable to type 'number'.
tabIndex="0"
className="toggle"
onClick={onArrowClick}
@@ -66,7 +67,11 @@ function displayHeaderCell(
}
export class TableRenderer extends Component {
- constructor(props) {
+ cachedBasePivotSettings: $TSFixMe;
+
+ cachedProps: $TSFixMe;
+
+ constructor(props: $TSFixMe) {
super(props);
// We need state to record which entries are collapsed and which aren't.
@@ -82,21 +87,26 @@ export class TableRenderer extends Component {
// One-time extraction of pivot settings that we'll use throughout the render.
const { props } = this;
+ // @ts-expect-error TS(2339): Property 'cols' does not exist on type 'Readonly<{... Remove this comment to see the full error message
const colAttrs = props.cols;
+ // @ts-expect-error TS(2339): Property 'rows' does not exist on type 'Readonly<{... Remove this comment to see the full error message
const rowAttrs = props.rows;
const tableOptions = {
rowTotals: true,
colTotals: true,
+ // @ts-expect-error TS(2339): Property 'tableOptions' does not exist on type 'Re... Remove this comment to see the full error message
...props.tableOptions,
};
const rowTotals = tableOptions.rowTotals || colAttrs.length === 0;
const colTotals = tableOptions.colTotals || rowAttrs.length === 0;
+ // @ts-expect-error TS(2339): Property 'namesMapping' does not exist on type 'Re... Remove this comment to see the full error message
const namesMapping = props.namesMapping || {};
const subtotalOptions = {
arrowCollapsed: '\u25B2',
arrowExpanded: '\u25BC',
+ // @ts-expect-error TS(2339): Property 'subtotalOptions' does not exist on type ... Remove this comment to see the full error message
...props.subtotalOptions,
};
@@ -130,12 +140,14 @@ export class TableRenderer extends Component {
const colTotalCallbacks = {};
let grandTotalCallback = null;
if (tableOptions.clickCallback) {
- rowKeys.forEach(rowKey => {
+ rowKeys.forEach((rowKey: $TSFixMe) => {
const flatRowKey = flatKey(rowKey);
if (!(flatRowKey in cellCallbacks)) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
cellCallbacks[flatRowKey] = {};
}
- colKeys.forEach(colKey => {
+ colKeys.forEach((colKey: $TSFixMe) => {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
cellCallbacks[flatRowKey][flatKey(colKey)] = this.clickHandler(
pivotData,
rowKey,
@@ -146,7 +158,8 @@ export class TableRenderer extends Component {
// Add in totals as well.
if (rowTotals) {
- rowKeys.forEach(rowKey => {
+ rowKeys.forEach((rowKey: $TSFixMe) => {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
rowTotalCallbacks[flatKey(rowKey)] = this.clickHandler(
pivotData,
rowKey,
@@ -155,7 +168,8 @@ export class TableRenderer extends Component {
});
}
if (colTotals) {
- colKeys.forEach(colKey => {
+ colKeys.forEach((colKey: $TSFixMe) => {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
colTotalCallbacks[flatKey(colKey)] = this.clickHandler(
pivotData,
[],
@@ -185,12 +199,15 @@ export class TableRenderer extends Component {
colTotalCallbacks,
grandTotalCallback,
namesMapping,
+ // @ts-expect-error TS(2339): Property 'allowRenderHtml' does not exist on type ... Remove this comment to see the full error message
allowRenderHtml: props.allowRenderHtml,
};
}
- clickHandler(pivotData, rowValues, colValues) {
+ clickHandler(pivotData: $TSFixMe, rowValues: $TSFixMe, colValues: $TSFixMe) {
+ // @ts-expect-error TS(2339): Property 'cols' does not exist on type 'Readonly<{... Remove this comment to see the full error message
const colAttrs = this.props.cols;
+ // @ts-expect-error TS(2339): Property 'rows' does not exist on type 'Readonly<{... Remove this comment to see the full error message
const rowAttrs = this.props.rows;
const value = pivotData.getAggregator(rowValues, colValues).value();
const filters = {};
@@ -198,6 +215,7 @@ export class TableRenderer extends Component {
for (let i = 0; i < colLimit; i += 1) {
const attr = colAttrs[i];
if (colValues[i] !== null) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
filters[attr] = colValues[i];
}
}
@@ -205,28 +223,31 @@ export class TableRenderer extends Component {
for (let i = 0; i < rowLimit; i += 1) {
const attr = rowAttrs[i];
if (rowValues[i] !== null) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
filters[attr] = rowValues[i];
}
}
- return e =>
+ return (e: $TSFixMe) =>
+ // @ts-expect-error TS(2339): Property 'tableOptions' does not exist on type 'Re... Remove this comment to see the full error message
this.props.tableOptions.clickCallback(e, value, filters, pivotData);
}
clickHeaderHandler(
- pivotData,
- values,
- attrs,
- attrIdx,
- callback,
+ pivotData: $TSFixMe,
+ values: $TSFixMe,
+ attrs: $TSFixMe,
+ attrIdx: $TSFixMe,
+ callback: $TSFixMe,
isSubtotal = false,
isGrandTotal = false,
) {
const filters = {};
for (let i = 0; i <= attrIdx; i += 1) {
const attr = attrs[i];
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
filters[attr] = values[i];
}
- return e =>
+ return (e: $TSFixMe) =>
callback(
e,
values[attrIdx],
@@ -237,79 +258,91 @@ export class TableRenderer extends Component {
);
}
- collapseAttr(rowOrCol, attrIdx, allKeys) {
- return e => {
+ collapseAttr(rowOrCol: $TSFixMe, attrIdx: $TSFixMe, allKeys: $TSFixMe) {
+ return (e: $TSFixMe) => {
// Collapse an entire attribute.
e.stopPropagation();
const keyLen = attrIdx + 1;
- const collapsed = allKeys.filter(k => k.length === keyLen).map(flatKey);
+ const collapsed = allKeys
+ .filter((k: $TSFixMe) => k.length === keyLen)
+ .map(flatKey);
const updates = {};
- collapsed.forEach(k => {
+ collapsed.forEach((k: $TSFixMe) => {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
updates[k] = true;
});
if (rowOrCol) {
this.setState(state => ({
+ // @ts-expect-error TS(2339): Property 'collapsedRows' does not exist on type 'R... Remove this comment to see the full error message
collapsedRows: { ...state.collapsedRows, ...updates },
}));
} else {
this.setState(state => ({
+ // @ts-expect-error TS(2339): Property 'collapsedCols' does not exist on type 'R... Remove this comment to see the full error message
collapsedCols: { ...state.collapsedCols, ...updates },
}));
}
};
}
- expandAttr(rowOrCol, attrIdx, allKeys) {
- return e => {
+ expandAttr(rowOrCol: $TSFixMe, attrIdx: $TSFixMe, allKeys: $TSFixMe) {
+ return (e: $TSFixMe) => {
// Expand an entire attribute. This implicitly implies expanding all of the
// parents as well. It's a bit inefficient but ah well...
e.stopPropagation();
const updates = {};
- allKeys.forEach(k => {
+ allKeys.forEach((k: $TSFixMe) => {
for (let i = 0; i <= attrIdx; i += 1) {
+ // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
updates[flatKey(k.slice(0, i + 1))] = false;
}
});
if (rowOrCol) {
this.setState(state => ({
+ // @ts-expect-error TS(2339): Property 'collapsedRows' does not exist on type 'R... Remove this comment to see the full error message
collapsedRows: { ...state.collapsedRows, ...updates },
}));
} else {
this.setState(state => ({
+ // @ts-expect-error TS(2339): Property 'collapsedCols' does not exist on type 'R... Remove this comment to see the full error message
collapsedCols: { ...state.collapsedCols, ...updates },
}));
}
};
}
- toggleRowKey(flatRowKey) {
- return e => {
+ toggleRowKey(flatRowKey: $TSFixMe) {
+ return (e: $TSFixMe) => {
e.stopPropagation();
this.setState(state => ({
collapsedRows: {
+ // @ts-expect-error TS(2339): Property 'collapsedRows' does not exist on type 'R... Remove this comment to see the full error message
...state.collapsedRows,
+ // @ts-expect-error TS(2339): Property 'collapsedRows' does not exist on type 'R... Remove this comment to see the full error message
[flatRowKey]: !state.collapsedRows[flatRowKey],
},
}));
};
}
- toggleColKey(flatColKey) {
- return e => {
+ toggleColKey(flatColKey: $TSFixMe) {
+ return (e: $TSFixMe) => {
e.stopPropagation();
this.setState(state => ({
collapsedCols: {
+ // @ts-expect-error TS(2339): Property 'collapsedCols' does not exist on type 'R... Remove this comment to see the full error message
...state.collapsedCols,
+ // @ts-expect-error TS(2339): Property 'collapsedCols' does not exist on type 'R... Remove this comment to see the full error message
[flatColKey]: !state.collapsedCols[flatColKey],
},
}));
};
}
- calcAttrSpans(attrArr, numAttrs) {
+ calcAttrSpans(attrArr: $TSFixMe, numAttrs: $TSFixMe) {
// Given an array of attribute values (i.e. each element is another array with
// the value at every level), compute the spans for every attribute value at
// every level. The return value is a nested array of the same shape. It has
@@ -342,7 +375,11 @@ export class TableRenderer extends Component {
return spans;
}
- renderColHeaderRow(attrName, attrIdx, pivotSettings) {
+ renderColHeaderRow(
+ attrName: $TSFixMe,
+ attrIdx: $TSFixMe,
+ pivotSettings: $TSFixMe,
+ ) {
// Render a single row in the column header at the top of the pivot table.
const {
@@ -365,6 +402,7 @@ export class TableRenderer extends Component {
omittedHighlightHeaderGroups = [],
highlightedHeaderCells,
dateFormatters,
+ // @ts-expect-error TS(2339): Property 'tableOptions' does not exist on type 'Re... Remove this comment to see the full error message
} = this.props.tableOptions;
const spaceCell =
@@ -415,7 +453,8 @@ export class TableRenderer extends Component {
if (highlightHeaderCellsOnHover) {
colLabelClass += ' hoverable';
}
- handleContextMenu = e =>
+ handleContextMenu = (e: $TSFixMe) =>
+ // @ts-expect-error TS(2339): Property 'onContextMenu' does not exist on type 'R... Remove this comment to see the full error message
this.props.onContextMenu(e, colKey, undefined, {
[attrName]: colKey[attrIdx],
});
@@ -448,14 +487,17 @@ export class TableRenderer extends Component {
onClick={this.clickHeaderHandler(
pivotData,
colKey,
+ // @ts-expect-error TS(2339): Property 'cols' does not exist on type 'Readonly<{... Remove this comment to see the full error message
this.props.cols,
attrIdx,
+ // @ts-expect-error TS(2339): Property 'tableOptions' does not exist on type 'Re... Remove this comment to see the full error message
this.props.tableOptions.clickColumnHeaderCallback,
)}
onContextMenu={handleContextMenu}
>
{displayHeaderCell(
needToggle,
+ // @ts-expect-error TS(2339): Property 'collapsedCols' does not exist on type 'R... Remove this comment to see the full error message
this.state.collapsedCols[flatColKey]
? arrowCollapsed
: arrowExpanded,
@@ -478,8 +520,10 @@ export class TableRenderer extends Component {
onClick={this.clickHeaderHandler(
pivotData,
colKey,
+ // @ts-expect-error TS(2339): Property 'cols' does not exist on type 'Readonly<{... Remove this comment to see the full error message
this.props.cols,
attrIdx,
+ // @ts-expect-error TS(2339): Property 'tableOptions' does not exist on type 'Re... Remove this comment to see the full error message
this.props.tableOptions.clickColumnHeaderCallback,
true,
)}
@@ -502,14 +546,17 @@ export class TableRenderer extends Component {
onClick={this.clickHeaderHandler(
pivotData,
[],
+ // @ts-expect-error TS(2339): Property 'cols' does not exist on type 'Readonly<{... Remove this comment to see the full error message
this.props.cols,
attrIdx,
+ // @ts-expect-error TS(2339): Property 'tableOptions' does not exist on type 'Re... Remove this comment to see the full error message
this.props.tableOptions.clickColumnHeaderCallback,
false,
true,
)}
>
{t('Total (%(aggregatorName)s)', {
+ // @ts-expect-error TS(2339): Property 'aggregatorName' does not exist on type '... Remove this comment to see the full error message
aggregatorName: t(this.props.aggregatorName),
})}
</th>
@@ -519,7 +566,7 @@ export class TableRenderer extends Component {
return <tr key={`colAttr-${attrIdx}`}>{cells}</tr>;
}
- renderRowHeaderRow(pivotSettings) {
+ renderRowHeaderRow(pivotSettings: $TSFixMe) {
// Render just the attribute names of the rows (the actual attribute values
// will show up in the individual rows).
@@ -537,7 +584,7 @@ export class TableRenderer extends Component {
} = pivotSettings;
return (
<tr key="rowHdr">
- {rowAttrs.map((r, i) => {
+ {rowAttrs.map((r: $TSFixMe, i: $TSFixMe) => {
const needLabelToggle =
rowSubtotalDisplay.enabled && i !== rowAttrs.length - 1;
let arrowClickHandle = null;
@@ -569,8 +616,10 @@ export class TableRenderer extends Component {
onClick={this.clickHeaderHandler(
pivotData,
[],
+ // @ts-expect-error TS(2339): Property 'rows' does not exist on type 'Readonly<{... Remove this comment to see the full error message
this.props.rows,
0,
+ // @ts-expect-error TS(2339): Property 'tableOptions' does not exist on type 'Re... Remove this comment to see the full error message
this.props.tableOptions.clickRowHeaderCallback,
false,
true,
@@ -578,6 +627,7 @@ export class TableRenderer extends Component {
>
{colAttrs.length === 0
? t('Total (%(aggregatorName)s)', {
+ // @ts-expect-error TS(2339): Property 'aggregatorName' does not exist on type '... Remove this comment to see the full error message
aggregatorName: t(this.props.aggregatorName),
})
: null}
@@ -586,7 +636,7 @@ export class TableRenderer extends Component {
);
}
- renderTableRow(rowKey, rowIdx, pivotSettings) {
+ renderTableRow(rowKey: $TSFixMe, rowIdx: $TSFixMe, pivotSettings: $TSFixMe) {
// Render a single row in the pivot table.
const {
@@ -611,18 +661,20 @@ export class TableRenderer extends Component {
highlightedHeaderCells,
cellColorFormatters,
dateFormatters,
+ // @ts-expect-error TS(2339): Property 'tableOptions' does not exist on type 'Re... Remove this comment to see the full error message
} = this.props.tableOptions;
const flatRowKey = flatKey(rowKey);
const colIncrSpan = colAttrs.length !== 0 ? 1 : 0;
- const attrValueCells = rowKey.map((r, i) => {
+ const attrValueCells = rowKey.map((r: $TSFixMe, i: $TSFixMe) => {
let handleContextMenu;
let valueCellClassName = 'pvtRowLabel';
if (!omittedHighlightHeaderGroups.includes(rowAttrs[i])) {
if (highlightHeaderCellsOnHover) {
valueCellClassName += ' hoverable';
}
- handleContextMenu = e =>
+ handleContextMenu = (e: $TSFixMe) =>
+ // @ts-expect-error TS(2339): Property 'onContextMenu' does not exist on type 'R... Remove this comment to see the full error message
this.props.onContextMenu(e, undefined, rowKey, {
[rowAttrs[i]]: r,
});
@@ -658,14 +710,17 @@ export class TableRenderer extends Component {
onClick={this.clickHeaderHandler(
pivotData,
rowKey,
+ // @ts-expect-error TS(2339): Property 'rows' does not exist on type 'Readonly<{... Remove this comment to see the full error message
this.props.rows,
i,
+ // @ts-expect-error TS(2339): Property 'tableOptions' does not exist on type 'Re... Remove this comment to see the full error message
this.props.tableOptions.clickRowHeaderCallback,
)}
onContextMenu={handleContextMenu}
>
{displayHeaderCell(
needRowToggle,
+ // @ts-expect-error TS(2339): Property 'collapsedRows' does not exist on type 'R... Remove this comment to see the full error message
this.state.collapsedRows[flatRowKey]
? arrowCollapsed
: arrowExpanded,
@@ -691,8 +746,10 @@ export class TableRenderer extends Component {
onClick={this.clickHeaderHandler(
pivotData,
rowKey,
+ // @ts-expect-error TS(2339): Property 'rows' does not exist on type 'Readonly<{... Remove this comment to see the full error message
this.props.rows,
rowKey.length,
+ // @ts-expect-error TS(2339): Property 'tableOptions' does not exist on type 'Re... Remove this comment to see the full error message
this.props.tableOptions.clickRowHeaderCallback,
true,
)}
@@ -702,13 +759,13 @@ export class TableRenderer extends Component {
) : null;
const rowClickHandlers = cellCallbacks[flatRowKey] || {};
- const valueCells = visibleColKeys.map(colKey => {
+ const valueCells = visibleColKeys.map((colKey: $TSFixMe) => {
const flatColKey = flatKey(colKey);
const agg = pivotData.getAggregator(rowKey, colKey);
const aggValue = agg.value();
const keys = [...rowKey, ...colKey];
- let backgroundColor;
+ let backgroundColor: $TSFixMe;
if (cellColorFormatters) {
Object.values(cellColorFormatters).forEach(cellColorFormatter => {
if (Array.isArray(cellColorFormatter)) {
@@ -739,6 +796,7 @@ export class TableRenderer extends Component {
className="pvtVal"
key={`pvtVal-${flatColKey}`}
onClick={rowClickHandlers[flatColKey]}
+ // @ts-expect-error TS(2339): Property 'onContextMenu' does not exist on type 'R... Remove this comment to see the full error message
onContextMenu={e => this.props.onContextMenu(e, colKey, rowKey)}
style={style}
>
@@ -757,6 +815,7 @@ export class TableRenderer extends Component {
key="total"
className="pvtTotal"
onClick={rowTotalCallbacks[flatRowKey]}
+ // @ts-expect-error TS(2339): Property 'onContextMenu' does not exist on type 'R... Remove this comment to see the full error message
onContextMenu={e => this.props.onContextMenu(e, undefined, rowKey)}
>
{agg.format(aggValue)}
@@ -774,7 +833,7 @@ export class TableRenderer extends Component {
return <tr key={`keyRow-${flatRowKey}`}>{rowCells}</tr>;
}
- renderTotalsRow(pivotSettings) {
+ renderTotalsRow(pivotSettings: $TSFixMe) {
// Render the final totals rows that has the totals for all the columns.
const {
@@ -796,20 +855,23 @@ export class TableRenderer extends Component {
onClick={this.clickHeaderHandler(
pivotData,
[],
+ // @ts-expect-error TS(2339): Property 'rows' does not exist on type 'Readonly<{... Remove this comment to see the full error message
this.props.rows,
0,
+ // @ts-expect-error TS(2339): Property 'tableOptions' does not exist on type 'Re... Remove this comment to see the full error message
this.props.tableOptions.clickRowHeaderCallback,
false,
true,
)}
>
{t('Total (%(aggregatorName)s)', {
+ // @ts-expect-error TS(2339): Property 'aggregatorName' does not exist on type '... Remove this comment to see the full error message
aggregatorName: t(this.props.aggregatorName),
})}
</th>
);
- const totalValueCells = visibleColKeys.map(colKey => {
+ const totalValueCells = visibleColKeys.map((colKey: $TSFixMe) => {
const flatColKey = flatKey(colKey);
const agg = pivotData.getAggregator([], colKey);
const aggValue = agg.value();
@@ -820,6 +882,7 @@ export class TableRenderer extends Component {
className="pvtTotal pvtRowTotal"
key={`total-${flatColKey}`}
onClick={colTotalCallbacks[flatColKey]}
+ // @ts-expect-error TS(2339): Property 'onContextMenu' does not exist on type 'R... Remove this comment to see the full error message
onContextMenu={e => this.props.onContextMenu(e, colKey, undefined)}
style={{ padding: '5px' }}
>
@@ -838,6 +901,7 @@ export class TableRenderer extends Component {
key="total"
className="pvtGrandTotal pvtRowTotal"
onClick={grandTotalCallback}
+ // @ts-expect-error TS(2339): Property 'onContextMenu' does not exist on type 'R... Remove this comment to see the full error message
onContextMenu={e => this.props.onContextMenu(e, undefined, undefined)}
>
{agg.format(aggValue)}
@@ -854,11 +918,19 @@ export class TableRenderer extends Component {
);
}
- visibleKeys(keys, collapsed, numAttrs, subtotalDisplay) {
+ visibleKeys(
+ keys: $TSFixMe,
+ collapsed: $TSFixMe,
+ numAttrs: $TSFixMe,
+ subtotalDisplay: $TSFixMe,
+ ) {
return keys.filter(
- key =>
- // Is the key hidden by one of its parents?
- !key.some((k, j) => collapsed[flatKey(key.slice(0, j))]) &&
+ (
+ key: $TSFixMe, // Is the key hidden by one of its parents?
+ ) =>
+ !key.some(
+ (k: $TSFixMe, j: $TSFixMe) => collapsed[flatKey(key.slice(0, j))],
+ ) &&
// Leaf key.
(key.length === numAttrs ||
// Children hidden. Must show total.
@@ -892,12 +964,14 @@ export class TableRenderer extends Component {
// and column keys.
const visibleRowKeys = this.visibleKeys(
rowKeys,
+ // @ts-expect-error TS(2339): Property 'collapsedRows' does not exist on type 'R... Remove this comment to see the full error message
this.state.collapsedRows,
rowAttrs.length,
rowSubtotalDisplay,
);
const visibleColKeys = this.visibleKeys(
colKeys,
+ // @ts-expect-error TS(2339): Property 'collapsedCols' does not exist on type 'R... Remove this comment to see the full error message
this.state.collapsedCols,
colAttrs.length,
colSubtotalDisplay,
@@ -905,9 +979,9 @@ export class TableRenderer extends Component {
const pivotSettings = {
visibleRowKeys,
- maxRowVisible: Math.max(...visibleRowKeys.map(k => k.length)),
+ maxRowVisible: Math.max(...visibleRowKeys.map((k: $TSFixMe) => k.length)),
visibleColKeys,
- maxColVisible: Math.max(...visibleColKeys.map(k => k.length)),
+ maxColVisible: Math.max(...visibleColKeys.map((k: $TSFixMe) => k.length)),
rowAttrSpans: this.calcAttrSpans(visibleRowKeys, rowAttrs.length),
colAttrSpans: this.calcAttrSpans(visibleColKeys, colAttrs.length),
allowRenderHtml,
@@ -915,16 +989,17 @@ export class TableRenderer extends Component {
};
return (
+ // @ts-expect-error TS(2322): Type '{ children: Element; isDashboardEditMode: bo... Remove this comment to see the full error message
<Styles isDashboardEditMode={this.isDashboardEditMode()}>
<table className="pvtTable" role="grid">
<thead>
- {colAttrs.map((c, j) =>
+ {colAttrs.map((c: $TSFixMe, j: $TSFixMe) =>
this.renderColHeaderRow(c, j, pivotSettings),
)}
{rowAttrs.length !== 0 && this.renderRowHeaderRow(pivotSettings)}
</thead>
<tbody>
- {visibleRowKeys.map((r, i) =>
+ {visibleRowKeys.map((r: $TSFixMe, i: $TSFixMe) =>
this.renderTableRow(r, i, pivotSettings),
)}
{colTotals && this.renderTotalsRow(pivotSettings)}
@@ -935,9 +1010,12 @@ export class TableRenderer extends Component {
}
}
+// @ts-expect-error TS(2339): Property 'propTypes' does not exist on type 'typeo... Remove this comment to see the full error message
TableRenderer.propTypes = {
+ // @ts-expect-error TS(2339): Property 'propTypes' does not exist on type 'typeo... Remove this comment to see the full error message
...PivotData.propTypes,
tableOptions: PropTypes.object,
onContextMenu: PropTypes.func,
};
+// @ts-expect-error TS(2339): Property 'defaultProps' does not exist on type 'ty... Remove this comment to see the full error message
TableRenderer.defaultProps = { ...PivotData.defaultProps, tableOptions: {} };
... 20284 lines suppressed ...