From 4f2060f290d51b483c3ec00218e7936fcf39b2b1 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Tue, 31 Oct 2023 13:29:36 -0400 Subject: [PATCH] types --- src/index.tsx | 2 +- src/server.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index 8df00e75..fd0983d0 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -142,7 +142,7 @@ export class Helmet extends Component> { const { children: nestedChildren, ...childProps } = child.props; // convert React props to HTML attributes - const newChildProps = Object.keys(childProps).reduce((obj: any, key: string) => { + const newChildProps = Object.keys(childProps).reduce((obj: any, key) => { obj[HTML_TAG_MAP[key] || key] = childProps[key]; return obj; }, {}); diff --git a/src/server.ts b/src/server.ts index 20ddc667..5f292598 100644 --- a/src/server.ts +++ b/src/server.ts @@ -52,9 +52,9 @@ const generateTitleAsString = ( )}`; }; -const generateTagsAsString = (type: string, tags: HTMLElement[], encode: boolean) => - tags.reduce((str: string, t: any) => { - const tag = t as Attributes; +const generateTagsAsString = (type: string, tags: HTMLElement[], encode = true) => + tags.reduce((str, t) => { + const tag = t as unknown as Attributes; const attributeHtml = Object.keys(tag) .filter( attribute => @@ -120,7 +120,7 @@ const generateTagsAsReactComponent = (type: string, tags: any[]) => return React.createElement(type, mappedTag); }); -const getMethodsForTag = (type: string, tags: any, encode: boolean) => { +const getMethodsForTag = (type: string, tags: any, encode = true) => { switch (type) { case TAG_NAMES.TITLE: return { @@ -141,7 +141,7 @@ const getMethodsForTag = (type: string, tags: any, encode: boolean) => { } }; -const getPriorityMethods = ({ metaTags, linkTags, scriptTags, encode }: any) => { +const getPriorityMethods = ({ metaTags, linkTags, scriptTags, encode }: MappedServerState) => { const meta = prioritizer(metaTags, SEO_PRIORITY_TAGS.meta); const link = prioritizer(linkTags, SEO_PRIORITY_TAGS.link); const script = prioritizer(scriptTags, SEO_PRIORITY_TAGS.script);