refactor: fix card colors type and function to resolve vscode type errors (#3191)

This commit is contained in:
Alexandr Garbuzov 2023-09-11 11:47:55 +03:00 committed by GitHub
parent b0e15fb17c
commit b55aaa4cff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -198,12 +198,12 @@ const flexLayout = ({ items, gap, direction, sizes = [] }) => {
/**
* Object containing card colors.
* @typedef {{
* titleColor: string | string[];
* iconColor: string | string[];
* textColor: string | string[];
* titleColor: string;
* iconColor: string;
* textColor: string;
* bgColor: string | string[];
* borderColor: string | string[];
* ringColor: string | string[];
* borderColor: string;
* ringColor: string;
* }} CardColors
*/
@ -267,6 +267,18 @@ const getCardColors = ({
"#" + defaultBorderColor,
);
if (
typeof titleColor !== "string" ||
typeof textColor !== "string" ||
typeof ringColor !== "string" ||
typeof iconColor !== "string" ||
typeof borderColor !== "string"
) {
throw new Error(
"Unexpected behavior, all colors except background should be string.",
);
}
return { titleColor, iconColor, textColor, bgColor, borderColor, ringColor };
};