chartjs-plugin-annotation icon indicating copy to clipboard operation
chartjs-plugin-annotation copied to clipboard

TypeScript: `xMin`, `xMax`, `yMin`, `yMax` should accept undefined value as Scriptable options return value

Open tlserver opened this issue 1 year ago • 0 comments

The four options xMin, xMax, yMin, and yMax can accept an undefined value to indicate "growth to the chart boundary." Scriptable options for these four options also support an undefined value. However, TypeScript has incorrectly defined the types for these four options:

  xMax?: Scriptable<ScaleValue, PartialEventContext>,
  xMin?: Scriptable<ScaleValue, PartialEventContext>,
  yMax?: Scriptable<ScaleValue, PartialEventContext>,
  yMin?: Scriptable<ScaleValue, PartialEventContext>,

Using (_, __) => undefined should be a valid assignment, but currently, TypeScript raises a type error.

tlserver avatar Jan 17 '24 09:01 tlserver