Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/compiler/declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ type Parser<T extends Declaration["property"] = Declaration["property"]> = (

const propertyRename: Record<string, string> = {
"background-image": "experimental_backgroundImage",
"font-variant-caps": "font-variant",
};

const unparsedRuntimeParsing = new Set([
Expand Down Expand Up @@ -997,6 +998,18 @@ export function parseCustomDeclaration(
);
} else if (property === "corner-shape") {
parseCornerShape(declaration.value, builder);
} else if (property === "font-variant") {
const parsedFontVariant = parseFontVariantCaps(
parseUnparsed(
declaration.value.value,
builder,
property,
) as FontVariantCaps,
builder,
);
Comment on lines +1002 to +1009
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I followed what was already there in an else if statement above. declaration.value isn't even the correct type

Comment on lines +1002 to +1009
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't really think of a better solution here in this architecture - parseFontVariantCaps checks, if the value argument is the correct string, but it also expects that argument to be of FontVariantCaps type

if (parsedFontVariant !== undefined) {
builder.addDescriptor(property, parsedFontVariant);
}
} else if (
validProperties.has(property) ||
property.startsWith("--") ||
Expand Down