) {
return (
@@ -65,7 +60,7 @@ if (!isProduction) {
Router.events.on('routeChangeComplete', () => {
const path = '/_next/static/chunks/styles.chunk.module.css';
const chunksSelector = `link[href*="${path}"]:not([rel=preload])`;
- const chunksNodes = document.querySelectorAll(chunksSelector);
+ const chunksNodes: NodeListOf = document.querySelectorAll(chunksSelector);
if (chunksNodes.length) {
const timestamp = new Date().valueOf();
chunksNodes[0].href = `${path}?ts=${timestamp}`;
@@ -73,8 +68,7 @@ if (!isProduction) {
});
}
-// eslint-disable-next-line react/prop-types
-const App = ({ Component, pageProps, err }) => {
+const App = ({ Component, pageProps, err }: AppProps & { err: NextErrorComponent }) => {
useEffect(() => {
/* Analytics */
// TODO: Leverage prod-build-time-only env vars instead of window check
@@ -91,7 +85,7 @@ const App = ({ Component, pageProps, err }) => {
setupLogRocketReact(LogRocket);
// Per library docs, Fingerprint2 should not run immediately
- if (window.requestIdleCallback) {
+ if ('requestIdleCallback' in window) {
requestIdleCallback(setLogRocketFingerprint);
} else {
setTimeout(setLogRocketFingerprint, 500);
@@ -103,7 +97,7 @@ const App = ({ Component, pageProps, err }) => {
if (font.url) {
const link = document.createElement('link');
link.href = font.url;
- link.rel = 'stylesheet'; // eslint-disable-line unicorn/prevent-abbreviations
+ link.rel = 'stylesheet';
document.head.append(link);
}
diff --git a/pages/_document.js b/pages/_document.tsx
similarity index 91%
rename from pages/_document.js
rename to pages/_document.tsx
index 2742a72ad..cee32ee3c 100644
--- a/pages/_document.js
+++ b/pages/_document.tsx
@@ -1,8 +1,8 @@
-import Document, { Html, Head, Main, NextScript } from 'next/document';
+import Document, { Html, Head, Main, NextScript, DocumentContext } from 'next/document';
import { clientTokens } from 'common/config/environment';
export default class MyDocument extends Document {
- static async getInitialProps(ctx) {
+ static async getInitialProps(ctx: DocumentContext) {
const initialProps = await Document.getInitialProps(ctx);
return initialProps;
@@ -32,7 +32,6 @@ export default class MyDocument extends Document {
)}
{process.env.VERCEL_ENV === 'production' && (