From 15272b994aa9a4f301ed2eaa561e9c5587e1b68e Mon Sep 17 00:00:00 2001 From: Adrian Leonhard Date: Tue, 15 Aug 2017 13:47:18 +0200 Subject: [PATCH] [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. --- types/chroma-js/chroma-js-tests.ts | 5 +++++ types/chroma-js/index.d.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/types/chroma-js/chroma-js-tests.ts b/types/chroma-js/chroma-js-tests.ts index 53a3e912b8..82cfb7274d 100644 --- a/types/chroma-js/chroma-js-tests.ts +++ b/types/chroma-js/chroma-js-tests.ts @@ -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'); +} diff --git a/types/chroma-js/index.d.ts b/types/chroma-js/index.d.ts index 1b679b816a..41f7a36785 100644 --- a/types/chroma-js/index.d.ts +++ b/types/chroma-js/index.d.ts @@ -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;