score:1

Since you know that d => d.y always returns a number, you can cast it as such:

interface XYPointNullable {
  x: number;
  y: number | null;
}

line<XYPointNullable>()
  .defined(d => d.y !== null)
  .x(d => d.x)
  .y(d => d.y as number);

This playground gave me no errors with that.


Related Query