ColorPicker: wrong value type definitions when using rgb or hsb format #2004
Labels
Type: Enhancement
Issue contains an enhancement related to a specific component. Additional functionality has been add
Milestone
I'm submitting a ... (check one with "x")
Codesandbox Case (Bug Reports)
Current behavior
When using
format="rgb"
orformat="hsb"
you get an object withr
,g
andb
fields or an object withh
,s
andb
fields. But the value is typed asstring
.Expected behavior
value should be typed as a union of all possible types. A user would use type guards and assertion functions to deal with this. Ideally classes would be provided to be able to distinguish between rgb and hsb with an
instanceof
check.Alternatively, leave the value as string, drop the
format
property, and provide utility functions for user to convert between color value types instead. This actually seems like a better solution, though it is a breaking API change of course.Or just make it
value: any
, as it was before...Minimal reproduction of the problem with instructions
Please tell us about your environment:
PrimeReact version:
6.3.1
Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
The text was updated successfully, but these errors were encountered: