mirror of
https://github.com/tiennm99/github-readme-stats.git
synced 2026-05-27 01:59:58 +00:00
refactor: fix card colors type and function to resolve vscode type errors (#3191)
This commit is contained in:
committed by
GitHub
parent
b0e15fb17c
commit
b55aaa4cff
+17
-5
@@ -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 };
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user