-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(plugin-google-gtag, plugin-google-analytics): migrate packages to TS #5561
Conversation
✔️ [V2] 🔨 Explore the source changes: 9417845 🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/61453e445d60ed000765ecf4 😎 Browse the preview: https://deploy-preview-5561--docusaurus-2.netlify.app |
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-5561--docusaurus-2.netlify.app/ |
@@ -40,7 +43,7 @@ module.exports = function (context) { | |||
if (!isProd) { | |||
return {}; | |||
} | |||
return { | |||
const HTMLTags = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't understand, why create new const here, if we can return just object as it was before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That doesn't work and spits out a giant "Type not assignable" error... My best guess is due to some inference funkiness
FWIW, I'll just use type assertion
74cc9a5
to
9417845
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks
added some comments but we can merge it
@@ -13,7 +13,7 @@ export default (function () { | |||
} | |||
|
|||
return { | |||
onRouteUpdate({location}) { | |||
onRouteUpdate({location}: {location: Location}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably create a type for js client modules
gtag?: unknown; // TODO type plugin | ||
}; | ||
export type ThemeConfig = import('@docusaurus/theme-common').ThemeConfig & | ||
import('@docusaurus/plugin-google-analytics').ThemeConfig & |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even for refactored TS packages, we still want to move those themeConfig to options. This feels overly complex to have to provide plugin in plugin array + config in theme config: configuring things in one place would provide better DX
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will move them to options in the future, this is just temporary
Motivation
More migration, also provided typings to their
ThemeConfig
fields.Hopefully this makes refactoring the
themeConfig
options to plugin options more convenientHave you read the Contributing Guidelines on pull requests?
Yes