[chroma-js] Renamed namespace so types visible.

Renamed namespace Chroma which contains all the types to chroma so it is merged with the exported variable chroma and the types are externally visible. Added corresponding test.
This commit is contained in:
Adrian Leonhard
2017-08-15 13:47:18 +02:00
parent d4f42ab007
commit 15272b994a
2 changed files with 7 additions and 2 deletions
+5
View File
@@ -182,3 +182,8 @@ function test_scale() {
chroma.scale('RdYlBu');
chroma.scale('RdYlBu').padding(0.15);
}
function test_types() {
const color: chroma.Color = chroma('orange');
const scale: chroma.Scale = chroma.scale('RdYlBu');
}
+2 -2
View File
@@ -7,7 +7,7 @@
/**
* Chroma.js is a tiny library for all kinds of color conversions and color scales.
*/
declare namespace Chroma {
declare namespace chroma {
interface ColorSpaces {
rgb: [number, number, number];
rgba: [number, number, number, number];
@@ -353,7 +353,7 @@ declare namespace Chroma {
}
}
declare var chroma: Chroma.ChromaStatic;
declare var chroma: chroma.ChromaStatic;
export = chroma;
export as namespace chroma;