Skip to content

Commit 5babba2

Browse files
authored
type(convert): Add type assertion (#151)
1 parent 8a71246 commit 5babba2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/color-convert/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,4 +336,4 @@ export const equalHex = (first: string, second: string): boolean => {
336336
return equalColorObjects(hexToRgba(first), hexToRgba(second));
337337
};
338338

339-
export const validHex = (hex: string): boolean => /^#?([A-Fa-f0-9]{3,4}){1,2}$/.test(hex);
339+
export const validHex = (hex: string): hex is HexColor => /^#?([A-Fa-f0-9]{3,4}){1,2}$/.test(hex);

0 commit comments

Comments
 (0)