Skip to content

Commit 7ec7304

Browse files
committed
Narrow Heading type with 'as const'
Use `as const` on the Heading template literal so `h${headingLevel}` is inferred as a literal (e.g. 'h1') rather than a widened string.
1 parent f8129f7 commit 7ec7304

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/components/Card.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const aspectRatioMap = {
7272
};
7373
const aspectRatioValue = aspectRatioMap[aspectRatio];
7474
75-
const Heading = `h${headingLevel}`;
75+
const Heading = `h${headingLevel}` as const;
7676
7777
// The whole card is clickable through one stretched .card_link. When there is
7878
// a title, the title anchor carries it so its text names the link; otherwise

0 commit comments

Comments
 (0)