diff --git a/types/colornames/colornames-tests.ts b/types/colornames/colornames-tests.ts index 6fc9bb712a..f1a2cba66c 100644 --- a/types/colornames/colornames-tests.ts +++ b/types/colornames/colornames-tests.ts @@ -1,19 +1,17 @@ import colorNames = require("colornames"); +// $ExpectType string | undefined +colorNames("red"); +// $ExpectType string | undefined +colorNames("donkey"); // $ExpectType Color -const color = colorNames("red"); - -// $ExpectType string -color.value; +const blue = colorNames.get("blue"); // $ExpectType boolean | undefined -color.css; +blue.css; // $ExpectType boolean | undefined -color.vga; +blue.vga; // $ExpectType string -color.name; - -// $ExpectType Color -colorNames.get("blue"); +blue.name; // $ExpectType Color[] colorNames.get.all(); // $ExpectType Color[] diff --git a/types/colornames/index.d.ts b/types/colornames/index.d.ts index d9b331167b..1f93ca3030 100644 --- a/types/colornames/index.d.ts +++ b/types/colornames/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for colornames 1.1 // Project: https://github.com/timoxley/colornames#readme // Definitions by: Manuel Thalmann +// Benjamin Turner // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /** @@ -53,7 +54,7 @@ interface GlobalResolver { /** * Gets the color with the specified name. */ - (name: string): Color; + (name: string): string | undefined; /** * Provides the functionality to query colors.