Skip to content

fix(types): parameterize RadarController with its 'radar' chart type - #12318

Open
marina-semeia wants to merge 1 commit into
chartjs:masterfrom
marina-semeia:fix/types-radar-controller-chart-type
Open

marina-semeia wants to merge 1 commit into
chartjs:masterfrom
marina-semeia:fix/types-radar-controller-chart-type

Conversation

@marina-semeia

@marina-semeia marina-semeia commented Sep 24, 2026 •

Copy link
Copy Markdown

RadarController is declared as the unparameterized DatasetController, so its TType falls back to the generic ChartType:

export type RadarController = DatasetController

As a result, a subclass of RadarController loses radar-specific typing. For example, getParsed() returns the union of all parsed data types instead of RadialParsedData:

class CustomRadarController extends RadarController {
  override updateElements(points, start, count, mode) {
    for (let i = start; i < start + count; i++) {
      const r = this.getParsed(i).r;
      // TS error: Property 'r' does not exist on type
      // 'number | CartesianParsedData | BarParsedData | BubbleParsedData | RadialParsedData'.
    }
  }
}

This is a common need when extending the radar controller (e.g. to position points between grid lines instead of on them).

Changes

  • RadarController is now DatasetController<'radar'> in src/types/index.d.ts.
  • Added a type test in test/types/controllers/radar_controller_subclass.ts (fails with TS2339 without the fix, passes with it).

Note

The other built-in controllers (BarController, LineController, BubbleController, DoughnutController, …) are declared the same unparameterized way. I kept this PR scoped to RadarController, but I'm happy to extend it to the others if you'd prefer a consistent change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant