score:6

Accepted answer

You can specify the type of range when you call d3.scaleLinear<TRange, TOutput>(). Since you are using strings, you can specify the type of your range as string:

let color = d3.scaleLinear<string, number>()
            .domain([0, 60])
            .range(["red", "blue"]);

Related Query

More Query from same tag