[@types/parse-color] adding types for the parse-color function (#35080)

This commit is contained in:
Andrew Crites 2019-04-30 13:11:47 -04:00 committed by Wesley Wigham
parent 08525d6073
commit e7cd8572db
4 changed files with 59 additions and 0 deletions

21
types/parse-color/index.d.ts vendored Normal file
View File

@ -0,0 +1,21 @@
// Type definitions for parse-color 1.0
// Project: https://github.com/substack/parse-color
// Definitions by: Andrew Crites <https://github.com/ajcrites>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace parseColor {
interface Color {
rgb: [number, number, number];
hsl: [number, number, number];
hsv: [number, number, number];
cmyk: [number, number, number, number];
keyword: string;
hex: string;
rgba: [number, number, number, number];
hsla: [number, number, number, number];
hsva: [number, number, number, number];
cmyka: [number, number, number, number, number];
}
}
declare function parseColor(cstr: string): parseColor.Color;
export = parseColor;

View File

@ -0,0 +1,14 @@
import * as parseColor from "parse-color";
const color = parseColor('lime');
color.rgb;
color.hsl;
color.hsv;
color.cmyk;
color.keyword;
color.hex;
color.rgba;
color.hsla;
color.hsva;
color.cmyka;

View File

@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"parse-color-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }