mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Fix colornames default export type definition (#35354)
* update colornames types * add name * fix linter errors * feedback
This commit is contained in:
parent
3b625a5f37
commit
5f8fe32ce2
@ -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[]
|
||||
|
||||
3
types/colornames/index.d.ts
vendored
3
types/colornames/index.d.ts
vendored
@ -1,6 +1,7 @@
|
||||
// Type definitions for colornames 1.1
|
||||
// Project: https://github.com/timoxley/colornames#readme
|
||||
// Definitions by: Manuel Thalmann <https://github.com/manuth>
|
||||
// Benjamin Turner <https://github.com/blturner>
|
||||
// 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.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user