Skip to content

Commit

Permalink
Use type assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Cena committed Sep 18, 2021
1 parent 7bdbac9 commit 9417845
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions packages/docusaurus-plugin-google-analytics/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import path from 'path';
import type {LoadContext, Plugin} from '@docusaurus/types';
import type {LoadContext, Plugin, HtmlTags} from '@docusaurus/types';
import type {ThemeConfig} from '@docusaurus/plugin-google-analytics';

export default function pluginGoogleAnalytics(context: LoadContext): Plugin {
Expand Down Expand Up @@ -43,7 +43,7 @@ export default function pluginGoogleAnalytics(context: LoadContext): Plugin {
if (!isProd) {
return {};
}
const HTMLTags = {
return {
headTags: [
{
tagName: 'link',
Expand All @@ -69,9 +69,8 @@ export default function pluginGoogleAnalytics(context: LoadContext): Plugin {
src: 'https://www.google-analytics.com/analytics.js',
},
},
],
] as HtmlTags,
};
return HTMLTags;
},
};
}
7 changes: 3 additions & 4 deletions packages/docusaurus-plugin-google-gtag/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import path from 'path';
import type {LoadContext, Plugin} from '@docusaurus/types';
import type {LoadContext, Plugin, HtmlTags} from '@docusaurus/types';
import type {ThemeConfig} from '@docusaurus/plugin-google-gtag';

export default function pluginGoogleGtag(context: LoadContext): Plugin {
Expand Down Expand Up @@ -43,7 +43,7 @@ export default function pluginGoogleGtag(context: LoadContext): Plugin {
if (!isProd) {
return {};
}
const HTMLTags = {
return {
// Gtag includes GA by default, so we also preconnect to google-analytics.
headTags: [
{
Expand Down Expand Up @@ -78,9 +78,8 @@ export default function pluginGoogleGtag(context: LoadContext): Plugin {
anonymizeIP ? "'anonymize_ip': true" : ''
} });`,
},
],
] as HtmlTags,
};
return HTMLTags;
},
};
}

0 comments on commit 9417845

Please sign in to comment.