score:5

Accepted answer

Well, if you look at the d3 source code a little further, the argument it's looking for you to pass is the scale:

function axis(orient, scale) {
  var tickArguments = [],
  ...

If you don't pass it the scale will go in as undefined.

But axis is a closure that provide an alternate way to provide a scale with a .scale "method".

axis.scale = function(_) {
  return arguments.length ? (scale = _, axis) : scale;
};

Your very next bit of code is passing the scale in using that "method".

Now with TypeScript certain concessions need to be made as it's not a loosy-goosy as JavaScript. So the typings author chose to follow the axis function signature. All that said, your TypeScript should just follow that example, and be:

const makeYLines = () => d3.axisLeft(yScale);

Related Query