Select to view content in your preferred language

Type definition bug: ModelOfType maps HeatChart to never, so createModel cannot infer HeatChartModel

180
2
Wednesday
DanRussell
Occasional Contributor

@ArcGIS/charts-components@5.0.18

The TypeScript type mapping for `ModelOfType<T>` excludes heat charts by mapping `ModelTypes.HeatChart` to `never`.
Because `createModel` returns `Promise<ModelOfType<T>>`, this causes incorrect typing for heat chart creation even though heat charts are supported and created at runtime.

import { createModel, ModelTypes } from "@arcgis/charts-components";
import FeatureLayer from "@arcgis/core/layers/FeatureLayer";

const layer = new FeatureLayer({ url: "..." });

const model = await createModel({
  chartType: ModelTypes.HeatChart,
  layer
});

// Expected: model inferred as BarChartModel | LineChartModel | ComboBarLineChartModel | BoxPlotModel | PieChartModel | ScatterplotModel | HistogramModel | GaugeModel | RadarChartModel | HeatChartModel

// Actual: model inferred as BarChartModel | LineChartModel | ComboBarLineChartModel | BoxPlotModel | PieChartModel | ScatterplotModel | HistogramModel | GaugeModel | RadarChartModel

Impact

- Incorrect IntelliSense and type narrowing for heat chart workflows.
- Forces consumer-side assertions/workarounds for otherwise valid API usage.

0 Kudos
2 Replies
DanRussell
Occasional Contributor

Additionally, HeatChartModel is not included here: @ArcGIS\charts-components\dist\model\index.d.ts

0 Kudos
HaoyanChen
Esri Contributor

Hi @DanRussell, thanks for letting us know about the typing issue here. We have looked into the issue and will be fixing for the upcoming release (version 5.1).

0 Kudos