Qix-/color

TS types error when access color property. #194

mrdulin posted onGitHub

Code here:

var Color = require("color")

const color = '#e6e6e6'
console.log(Color(color).hsl())
console.log(Color(color).hsl().color[2])

For JavaScript, I can access the color property from the returned value of .hsl() method.

https://runkit.com/embed/j7ng47ucd6ep

But when I use TypeScript, TSC throws an error:

Property 'color' does not exist on type 'Color<ColorParam>'

package versions:

"color": "^3.1.3",
"@types/color": "^3.0.1",

Hi - I don't maintain the types in the @types repositories; an issue should be opened there. Sorry for the trouble :/

posted by Qix- about 4 years ago

Fund this Issue

$0.00
Funded

Pull requests