From 927b63fa2e33cc5ee303554c0c43c9e89156b7c8 Mon Sep 17 00:00:00 2001 From: Benjamin Canac Date: Sun, 30 Jul 2023 20:04:04 +0200 Subject: [PATCH] fix(module): omit colors defined as strings --- src/colors.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/colors.ts b/src/colors.ts index cbe34c8e..4724f549 100644 --- a/src/colors.ts +++ b/src/colors.ts @@ -191,7 +191,11 @@ const safelistComponentAliasesMap = { const colorsAsRegex = (colors: string[]): string => colors.join('|') -export const excludeColors = (colors: object) => Object.keys(omit(colors, colorsToExclude)).map(color => kebabCase(color)) as string[] +export const excludeColors = (colors: object): string[] => { + return Object.entries(omit(colors, colorsToExclude)) + .filter(([, value]) => typeof value === 'object') + .map(([key]) => kebabCase(key)) +} export const generateSafelist = (colors: string[], globalColors) => { const baseSafelist = Object.keys(safelistByComponent).flatMap(component => safelistByComponent[component](colorsAsRegex(colors)))