The declarations in lib/color.d.ts are insufficiently strong. An expression like
ROT.Color.toRGB(ROT.Color.interpolate(color1, color2, 0.5))
is poorly typed because interpolate returns a number[], not the [number, number, number] taken by toRGB. From a quick overview of colors.js, I believe the type declarations could be updated without trouble, so I suggest that all (or at least most, barring unforeseen issues) instances of number[] in color.d.ts be replaced by the defined Color type. For example,
function interpolate(color1: Color, color2: Color, factor?: number): number[];
should be
function interpolate(color1: Color, color2: Color, factor?: number): Color;
The declarations in
lib/color.d.ts
are insufficiently strong. An expression likeROT.Color.toRGB(ROT.Color.interpolate(color1, color2, 0.5))
is poorly typed because interpolate returns anumber[]
, not the[number, number, number]
taken by toRGB. From a quick overview ofcolors.js
, I believe the type declarations could be updated without trouble, so I suggest that all (or at least most, barring unforeseen issues) instances ofnumber[]
incolor.d.ts
be replaced by the definedColor
type. For example,function interpolate(color1: Color, color2: Color, factor?: number): number[];
should befunction interpolate(color1: Color, color2: Color, factor?: number): Color;