From 1b924a1e090a1b95c62d11537691755b354eb45e Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Thu, 18 Jan 2024 09:55:56 -0800 Subject: [PATCH 1/2] Fix getTrackingProps incompatibility with React's casing expectations. --- src/lib/components/badge/Badge.tsx | 1 + src/lib/components/button/BaseButton.tsx | 1 + src/lib/components/button/IconButton.tsx | 1 + src/lib/utils/getTrackingProps.ts | 7 +++++-- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lib/components/badge/Badge.tsx b/src/lib/components/badge/Badge.tsx index 90ea40a..c0fade9 100644 --- a/src/lib/components/badge/Badge.tsx +++ b/src/lib/components/badge/Badge.tsx @@ -31,6 +31,7 @@ export const VuiBadge = ({ children, className, color, onClick, href, target, tr if (href) { return ( + // @ts-expect-error Type 'string' is not assignable to type 'HTMLAttributeReferrerPolicy | undefined'. {children} diff --git a/src/lib/components/button/BaseButton.tsx b/src/lib/components/button/BaseButton.tsx index d5403f3..6b613a8 100644 --- a/src/lib/components/button/BaseButton.tsx +++ b/src/lib/components/button/BaseButton.tsx @@ -81,6 +81,7 @@ export const BaseButton = forwardRef( }); return ( + // @ts-expect-error Type 'string' is not assignable to type 'HTMLAttributeReferrerPolicy | undefined'. ( if (href) { return ( + // @ts-expect-error Type 'string' is not assignable to type 'HTMLAttributeReferrerPolicy | undefined'. diff --git a/src/lib/utils/getTrackingProps.ts b/src/lib/utils/getTrackingProps.ts index afeb59c..3e3704e 100644 --- a/src/lib/utils/getTrackingProps.ts +++ b/src/lib/utils/getTrackingProps.ts @@ -3,8 +3,11 @@ export const getTrackingProps = (track?: boolean) => { return { // Protect against tabnabbing. rel: "noopener", - // Provide information for tracking, e.g. to docs. - referrerpolicy: "no-referrer-when-downgrade" + // Provide information for tracking, e.g. to docs. Technically this should be + // 'referrerpolicy' but React wants it in camel case. This clashes with + // react-router Link's HTMLAttributeReferrerPolicy type definition so we + // have to use @ts-expect-error at callsites that consume this helper. + referrerPolicy: "no-referrer-when-downgrade" }; } // Protect against tabnabbing and strip information from the referrer header. From 2efc7e4ca1996fc6918449b663a138503383fbba Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Thu, 18 Jan 2024 09:59:00 -0800 Subject: [PATCH 2/2] Remove unused var. --- src/lib/components/summary/Summary.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/components/summary/Summary.tsx b/src/lib/components/summary/Summary.tsx index ee96523..d72f320 100644 --- a/src/lib/components/summary/Summary.tsx +++ b/src/lib/components/summary/Summary.tsx @@ -6,7 +6,7 @@ import { VuiText } from "../typography/Text"; const markDownCitations = (summary: string) => { const citations = extractCitations(summary); return citations - .reduce((accum, { text, references }, index) => { + .reduce((accum, { text, references }) => { if (references) { accum.push(text);