mirror of
https://github.com/chenasraf/DefinitelyTyped.git
synced 2026-05-18 01:49:01 +00:00
38 lines
662 B
TypeScript
38 lines
662 B
TypeScript
import quantize = require('quantize');
|
|
|
|
// $ExpectType false | ColorMap
|
|
const colorMap = quantize(
|
|
[
|
|
[255, 0, 0],
|
|
[0, 255, 0],
|
|
[0, 0, 255],
|
|
],
|
|
2,
|
|
);
|
|
|
|
if (colorMap !== false) {
|
|
// $ExpectType RgbPixel[]
|
|
colorMap.palette();
|
|
|
|
// $ExpectType number
|
|
colorMap.size();
|
|
|
|
// $ExpectType RgbPixel
|
|
colorMap.map([100, 100, 100]);
|
|
|
|
// $ExpectType RgbPixel
|
|
colorMap.nearest([200, 100, 0]);
|
|
|
|
// $ExpectType void
|
|
colorMap.push(colorMap.vboxes.peek().vbox);
|
|
}
|
|
|
|
// @ts-expect-error
|
|
quantize([[255, 0]], 2);
|
|
|
|
// @ts-expect-error
|
|
quantize([[255, 0, 0]]);
|
|
|
|
// @ts-expect-error
|
|
quantize([[255, 0, 0]], '2');
|