Skip to content

Commit 6977738

Browse files
committed
index.d.ts back in the package — the 2.1.0 files list dropped it; types wired into exports; space optional on failure, 0xRRGGBB input, gray/xyz/luv in the union (closes #14)
1 parent bc611fb commit 6977738

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

index.d.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
export default function parse(color: string): {
2-
space: 'rgb' | 'hsl' | 'hwb' | 'cmyk' | 'lab' | 'lch' | 'oklab' | 'oklch' | string;
1+
/** Parse a color string or 0xRRGGBB number. `space` is absent if input is not parseable. */
2+
export default function parse(color: string | number): {
3+
space?: 'rgb' | 'hsl' | 'hwb' | 'cmyk' | 'gray' | 'xyz' | 'luv' | 'lab' | 'lch' | 'oklab' | 'oklch' | (string & {});
34
values: number[];
45
alpha: number;
56
}

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@
55
"main": "index.js",
66
"browser": "index.js",
77
"module": "./index.js",
8+
"types": "./index.d.ts",
89
"type": "module",
910
"exports": {
10-
".": "./index.js"
11+
".": {
12+
"types": "./index.d.ts",
13+
"default": "./index.js"
14+
}
1115
},
1216
"files": [
13-
"index.js"
17+
"index.js",
18+
"index.d.ts"
1419
],
1520
"scripts": {
1621
"test": "node test.js"

0 commit comments

Comments
 (0)