react-color icon indicating copy to clipboard operation
react-color copied to clipboard

Add type for Hex color

Open ximex opened this issue 1 year ago • 1 comments

add a type for hex-color strings that is a bit stricter than only string. type HexColor = `#${string}`;

ximex avatar Apr 11 '24 09:04 ximex

@ximex I can add this type to the package. I tried using the HexColor type, but it may not be easy to use in the code because many places have done error handling, which causes type errors.

https://github.com/uiwjs/react-color/blob/632d4e9201e26b42ee7d5bfeda407144e9a6e2f3/packages/color-convert/src/index.ts#L335-L336

https://github.com/uiwjs/react-color/blob/632d4e9201e26b42ee7d5bfeda407144e9a6e2f3/packages/color-convert/src/index.ts#L339

jaywcjlove avatar Apr 11 '24 12:04 jaywcjlove

is already done here: https://github.com/uiwjs/react-color/pull/155/files#diff-4a1d4aef5f7a97716359b980c22ef670d78d5f779651e57fe94589767051e95bR306

ximex avatar Sep 24 '24 12:09 ximex