Skip to content

Commit

Permalink
Fix getCommonServerSideProps and getExamplesCommonServerSideProps TS …
Browse files Browse the repository at this point in the history
…props + rename StaticParams to CommonServerSideParams
  • Loading branch information
Vadorequest committed Jun 3, 2020
1 parent 87ebfd0 commit 59bd4f7
Show file tree
Hide file tree
Showing 42 changed files with 131 additions and 128 deletions.
4 changes: 2 additions & 2 deletions src/pages/404.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { NextRouter, useRouter } from 'next/router';
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
import React from 'react';
import DefaultLayout from '../components/pageLayouts/DefaultLayout';
import { StaticParams } from '../types/nextjs/StaticParams';
import { CommonServerSideParams } from '../types/nextjs/CommonServerSideParams';
import { SoftPageProps } from '../types/pageProps/SoftPageProps';
import { SSGPageProps } from '../types/pageProps/SSGPageProps';
import { DEFAULT_LOCALE, LANG_EN, LANG_FR } from '../utils/i18n/i18n';
Expand All @@ -25,7 +25,7 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
* @see https://github.com/vercel/next.js/discussions/10949#discussioncomment-6884
* @see https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation
*/
export const getStaticProps: GetStaticProps<SSGPageProps, StaticParams> = getExamplesCommonStaticProps;
export const getStaticProps: GetStaticProps<SSGPageProps, CommonServerSideParams> = getExamplesCommonStaticProps;

/**
* SSG pages are first rendered by the server (during static bundling)
Expand Down
6 changes: 3 additions & 3 deletions src/pages/[locale]/examples/built-in-features/analytics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import DocPage from '../../../../components/doc/DocPage';
import DefaultLayout from '../../../../components/pageLayouts/DefaultLayout';
import Code from '../../../../components/utils/Code';
import ExternalLink from '../../../../components/utils/ExternalLink';
import { StaticParams } from '../../../../types/nextjs/StaticParams';
import { CommonServerSideParams } from '../../../../types/nextjs/CommonServerSideParams';
import { OnlyBrowserPageProps } from '../../../../types/pageProps/OnlyBrowserPageProps';
import { SSGPageProps } from '../../../../types/pageProps/SSGPageProps';
import { getExamplesCommonStaticPaths, getExamplesCommonStaticProps } from '../../../../utils/nextjs/SSG';
Expand All @@ -24,7 +24,7 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getExamplesCommonStaticPaths;
export const getStaticPaths: GetStaticPaths<CommonServerSideParams> = getExamplesCommonStaticPaths;

/**
* Only executed on the server side at build time.
Expand All @@ -34,7 +34,7 @@ export const getStaticPaths: GetStaticPaths<StaticParams> = getExamplesCommonSta
* @see https://github.com/vercel/next.js/discussions/10949#discussioncomment-6884
* @see https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation
*/
export const getStaticProps: GetStaticProps<SSGPageProps, StaticParams> = getExamplesCommonStaticProps;
export const getStaticProps: GetStaticProps<SSGPageProps, CommonServerSideParams> = getExamplesCommonStaticProps;

/**
* SSG pages are first rendered by the server (during static bundling)
Expand Down
6 changes: 3 additions & 3 deletions src/pages/[locale]/examples/built-in-features/animations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import DefaultLayout from '../../../../components/pageLayouts/DefaultLayout';
import AnimatedLoader from '../../../../components/svg/AnimatedLoader';
import Code from '../../../../components/utils/Code';
import ExternalLink from '../../../../components/utils/ExternalLink';
import { StaticParams } from '../../../../types/nextjs/StaticParams';
import { CommonServerSideParams } from '../../../../types/nextjs/CommonServerSideParams';
import { OnlyBrowserPageProps } from '../../../../types/pageProps/OnlyBrowserPageProps';
import { SSGPageProps } from '../../../../types/pageProps/SSGPageProps';
import { getExamplesCommonStaticPaths, getExamplesCommonStaticProps } from '../../../../utils/nextjs/SSG';
Expand All @@ -24,7 +24,7 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getExamplesCommonStaticPaths;
export const getStaticPaths: GetStaticPaths<CommonServerSideParams> = getExamplesCommonStaticPaths;

/**
* Only executed on the server side at build time.
Expand All @@ -34,7 +34,7 @@ export const getStaticPaths: GetStaticPaths<StaticParams> = getExamplesCommonSta
* @see https://github.com/vercel/next.js/discussions/10949#discussioncomment-6884
* @see https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation
*/
export const getStaticProps: GetStaticProps<SSGPageProps, StaticParams> = getExamplesCommonStaticProps;
export const getStaticProps: GetStaticProps<SSGPageProps, CommonServerSideParams> = getExamplesCommonStaticProps;

/**
* SSG pages are first rendered by the server (during static bundling)
Expand Down
6 changes: 3 additions & 3 deletions src/pages/[locale]/examples/built-in-features/api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import BuiltInFeaturesSidebar from '../../../../components/doc/BuiltInFeaturesSi
import DocPage from '../../../../components/doc/DocPage';
import DefaultLayout from '../../../../components/pageLayouts/DefaultLayout';
import Code from '../../../../components/utils/Code';
import { StaticParams } from '../../../../types/nextjs/StaticParams';
import { CommonServerSideParams } from '../../../../types/nextjs/CommonServerSideParams';
import { OnlyBrowserPageProps } from '../../../../types/pageProps/OnlyBrowserPageProps';
import { SSGPageProps } from '../../../../types/pageProps/SSGPageProps';
import { getExamplesCommonStaticPaths, getExamplesCommonStaticProps } from '../../../../utils/nextjs/SSG';
Expand All @@ -23,7 +23,7 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getExamplesCommonStaticPaths;
export const getStaticPaths: GetStaticPaths<CommonServerSideParams> = getExamplesCommonStaticPaths;

/**
* Only executed on the server side at build time.
Expand All @@ -33,7 +33,7 @@ export const getStaticPaths: GetStaticPaths<StaticParams> = getExamplesCommonSta
* @see https://github.com/vercel/next.js/discussions/10949#discussioncomment-6884
* @see https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation
*/
export const getStaticProps: GetStaticProps<SSGPageProps, StaticParams> = getExamplesCommonStaticProps;
export const getStaticProps: GetStaticProps<SSGPageProps, CommonServerSideParams> = getExamplesCommonStaticProps;

/**
* SSG pages are first rendered by the server (during static bundling)
Expand Down
6 changes: 3 additions & 3 deletions src/pages/[locale]/examples/built-in-features/css-in-js.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import DocPage from '../../../../components/doc/DocPage';
import DefaultLayout from '../../../../components/pageLayouts/DefaultLayout';
import Code from '../../../../components/utils/Code';
import ExternalLink from '../../../../components/utils/ExternalLink';
import { StaticParams } from '../../../../types/nextjs/StaticParams';
import { CommonServerSideParams } from '../../../../types/nextjs/CommonServerSideParams';
import { OnlyBrowserPageProps } from '../../../../types/pageProps/OnlyBrowserPageProps';
import { SSGPageProps } from '../../../../types/pageProps/SSGPageProps';
import { getExamplesCommonStaticPaths, getExamplesCommonStaticProps } from '../../../../utils/nextjs/SSG';
Expand All @@ -24,7 +24,7 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getExamplesCommonStaticPaths;
export const getStaticPaths: GetStaticPaths<CommonServerSideParams> = getExamplesCommonStaticPaths;

/**
* Only executed on the server side at build time.
Expand All @@ -34,7 +34,7 @@ export const getStaticPaths: GetStaticPaths<StaticParams> = getExamplesCommonSta
* @see https://github.com/vercel/next.js/discussions/10949#discussioncomment-6884
* @see https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation
*/
export const getStaticProps: GetStaticProps<SSGPageProps, StaticParams> = getExamplesCommonStaticProps;
export const getStaticProps: GetStaticProps<SSGPageProps, CommonServerSideParams> = getExamplesCommonStaticProps;

/**
* SSG pages are first rendered by the server (during static bundling)
Expand Down
6 changes: 3 additions & 3 deletions src/pages/[locale]/examples/built-in-features/docs-site.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import BuiltInFeaturesSidebar from '../../../../components/doc/BuiltInFeaturesSi
import DocPage from '../../../../components/doc/DocPage';
import DefaultLayout from '../../../../components/pageLayouts/DefaultLayout';
import ExternalLink from '../../../../components/utils/ExternalLink';
import { StaticParams } from '../../../../types/nextjs/StaticParams';
import { CommonServerSideParams } from '../../../../types/nextjs/CommonServerSideParams';
import { OnlyBrowserPageProps } from '../../../../types/pageProps/OnlyBrowserPageProps';
import { SSGPageProps } from '../../../../types/pageProps/SSGPageProps';
import { getExamplesCommonStaticPaths, getExamplesCommonStaticProps } from '../../../../utils/nextjs/SSG';
Expand All @@ -23,7 +23,7 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getExamplesCommonStaticPaths;
export const getStaticPaths: GetStaticPaths<CommonServerSideParams> = getExamplesCommonStaticPaths;

/**
* Only executed on the server side at build time.
Expand All @@ -33,7 +33,7 @@ export const getStaticPaths: GetStaticPaths<StaticParams> = getExamplesCommonSta
* @see https://github.com/vercel/next.js/discussions/10949#discussioncomment-6884
* @see https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation
*/
export const getStaticProps: GetStaticProps<SSGPageProps, StaticParams> = getExamplesCommonStaticProps;
export const getStaticProps: GetStaticProps<SSGPageProps, CommonServerSideParams> = getExamplesCommonStaticProps;

/**
* SSG pages are first rendered by the server (during static bundling)
Expand Down
6 changes: 3 additions & 3 deletions src/pages/[locale]/examples/built-in-features/hosting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import BuiltInFeaturesSidebar from '../../../../components/doc/BuiltInFeaturesSi
import DocPage from '../../../../components/doc/DocPage';
import DefaultLayout from '../../../../components/pageLayouts/DefaultLayout';
import ExternalLink from '../../../../components/utils/ExternalLink';
import { StaticParams } from '../../../../types/nextjs/StaticParams';
import { CommonServerSideParams } from '../../../../types/nextjs/CommonServerSideParams';
import { OnlyBrowserPageProps } from '../../../../types/pageProps/OnlyBrowserPageProps';
import { SSGPageProps } from '../../../../types/pageProps/SSGPageProps';
import { getExamplesCommonStaticPaths, getExamplesCommonStaticProps } from '../../../../utils/nextjs/SSG';
Expand All @@ -23,7 +23,7 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getExamplesCommonStaticPaths;
export const getStaticPaths: GetStaticPaths<CommonServerSideParams> = getExamplesCommonStaticPaths;

/**
* Only executed on the server side at build time.
Expand All @@ -33,7 +33,7 @@ export const getStaticPaths: GetStaticPaths<StaticParams> = getExamplesCommonSta
* @see https://github.com/vercel/next.js/discussions/10949#discussioncomment-6884
* @see https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation
*/
export const getStaticProps: GetStaticProps<SSGPageProps, StaticParams> = getExamplesCommonStaticProps;
export const getStaticProps: GetStaticProps<SSGPageProps, CommonServerSideParams> = getExamplesCommonStaticProps;

/**
* SSG pages are first rendered by the server (during static bundling)
Expand Down
6 changes: 3 additions & 3 deletions src/pages/[locale]/examples/built-in-features/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import BuiltInFeaturesSidebar from '../../../../components/doc/BuiltInFeaturesSi
import DocPage from '../../../../components/doc/DocPage';
import DefaultLayout from '../../../../components/pageLayouts/DefaultLayout';
import Code from '../../../../components/utils/Code';
import { StaticParams } from '../../../../types/nextjs/StaticParams';
import { CommonServerSideParams } from '../../../../types/nextjs/CommonServerSideParams';
import { OnlyBrowserPageProps } from '../../../../types/pageProps/OnlyBrowserPageProps';
import { SSGPageProps } from '../../../../types/pageProps/SSGPageProps';
import { getExamplesCommonStaticPaths, getExamplesCommonStaticProps } from '../../../../utils/nextjs/SSG';
Expand All @@ -24,7 +24,7 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getExamplesCommonStaticPaths;
export const getStaticPaths: GetStaticPaths<CommonServerSideParams> = getExamplesCommonStaticPaths;

/**
* Only executed on the server side at build time.
Expand All @@ -34,7 +34,7 @@ export const getStaticPaths: GetStaticPaths<StaticParams> = getExamplesCommonSta
* @see https://github.com/vercel/next.js/discussions/10949#discussioncomment-6884
* @see https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation
*/
export const getStaticProps: GetStaticProps<SSGPageProps, StaticParams> = getExamplesCommonStaticProps;
export const getStaticProps: GetStaticProps<SSGPageProps, CommonServerSideParams> = getExamplesCommonStaticProps;

/**
* SSG pages are first rendered by the server (during static bundling)
Expand Down
6 changes: 3 additions & 3 deletions src/pages/[locale]/examples/built-in-features/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { GetStaticPaths, GetStaticProps } from 'next';

import { StaticParams } from '../../../../types/nextjs/StaticParams';
import { CommonServerSideParams } from '../../../../types/nextjs/CommonServerSideParams';
import { SSGPageProps } from '../../../../types/pageProps/SSGPageProps';
import HostingPage, { getStaticPaths as getStaticPathsHomePage, getStaticProps as getStaticPropsHomePage } from './hosting';

// XXX This page is an "alias"
export const getStaticPaths: GetStaticPaths<StaticParams> = getStaticPathsHomePage;
export const getStaticProps: GetStaticProps<SSGPageProps, StaticParams> = getStaticPropsHomePage;
export const getStaticPaths: GetStaticPaths<CommonServerSideParams> = getStaticPathsHomePage;
export const getStaticProps: GetStaticProps<SSGPageProps, CommonServerSideParams> = getStaticPropsHomePage;

export default HostingPage;
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import BuiltInFeaturesSidebar from '../../../../components/doc/BuiltInFeaturesSi
import DocPage from '../../../../components/doc/DocPage';
import DefaultLayout from '../../../../components/pageLayouts/DefaultLayout';
import Code from '../../../../components/utils/Code';
import { StaticParams } from '../../../../types/nextjs/StaticParams';
import { CommonServerSideParams } from '../../../../types/nextjs/CommonServerSideParams';
import { OnlyBrowserPageProps } from '../../../../types/pageProps/OnlyBrowserPageProps';
import { SSGPageProps } from '../../../../types/pageProps/SSGPageProps';
import { getExamplesCommonStaticPaths, getExamplesCommonStaticProps } from '../../../../utils/nextjs/SSG';
Expand All @@ -23,7 +23,7 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getExamplesCommonStaticPaths;
export const getStaticPaths: GetStaticPaths<CommonServerSideParams> = getExamplesCommonStaticPaths;

/**
* Only executed on the server side at build time.
Expand All @@ -33,7 +33,7 @@ export const getStaticPaths: GetStaticPaths<StaticParams> = getExamplesCommonSta
* @see https://github.com/vercel/next.js/discussions/10949#discussioncomment-6884
* @see https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation
*/
export const getStaticProps: GetStaticProps<SSGPageProps, StaticParams> = getExamplesCommonStaticProps;
export const getStaticProps: GetStaticProps<SSGPageProps, CommonServerSideParams> = getExamplesCommonStaticProps;

/**
* SSG pages are first rendered by the server (during static bundling)
Expand Down
6 changes: 3 additions & 3 deletions src/pages/[locale]/examples/built-in-features/monitoring.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import BuiltInFeaturesSidebar from '../../../../components/doc/BuiltInFeaturesSi
import DocPage from '../../../../components/doc/DocPage';
import DefaultLayout from '../../../../components/pageLayouts/DefaultLayout';
import ExternalLink from '../../../../components/utils/ExternalLink';
import { StaticParams } from '../../../../types/nextjs/StaticParams';
import { CommonServerSideParams } from '../../../../types/nextjs/CommonServerSideParams';
import { OnlyBrowserPageProps } from '../../../../types/pageProps/OnlyBrowserPageProps';
import { SSGPageProps } from '../../../../types/pageProps/SSGPageProps';
import { getExamplesCommonStaticPaths, getExamplesCommonStaticProps } from '../../../../utils/nextjs/SSG';
Expand All @@ -23,7 +23,7 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getExamplesCommonStaticPaths;
export const getStaticPaths: GetStaticPaths<CommonServerSideParams> = getExamplesCommonStaticPaths;

/**
* Only executed on the server side at build time.
Expand All @@ -33,7 +33,7 @@ export const getStaticPaths: GetStaticPaths<StaticParams> = getExamplesCommonSta
* @see https://github.com/vercel/next.js/discussions/10949#discussioncomment-6884
* @see https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation
*/
export const getStaticProps: GetStaticProps<SSGPageProps, StaticParams> = getExamplesCommonStaticProps;
export const getStaticProps: GetStaticProps<SSGPageProps, CommonServerSideParams> = getExamplesCommonStaticProps;

/**
* SSG pages are first rendered by the server (during static bundling)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import BuiltInFeaturesSidebar from '../../../../components/doc/BuiltInFeaturesSi
import DocPage from '../../../../components/doc/DocPage';
import DefaultLayout from '../../../../components/pageLayouts/DefaultLayout';
import ExternalLink from '../../../../components/utils/ExternalLink';
import { StaticParams } from '../../../../types/nextjs/StaticParams';
import { CommonServerSideParams } from '../../../../types/nextjs/CommonServerSideParams';
import { OnlyBrowserPageProps } from '../../../../types/pageProps/OnlyBrowserPageProps';
import { SSGPageProps } from '../../../../types/pageProps/SSGPageProps';
import { getExamplesCommonStaticPaths, getExamplesCommonStaticProps } from '../../../../utils/nextjs/SSG';
Expand All @@ -23,7 +23,7 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-
* Only executed on the server side at build time
* Necessary when a page has dynamic routes and uses "getStaticProps"
*/
export const getStaticPaths: GetStaticPaths<StaticParams> = getExamplesCommonStaticPaths;
export const getStaticPaths: GetStaticPaths<CommonServerSideParams> = getExamplesCommonStaticPaths;

/**
* Only executed on the server side at build time.
Expand All @@ -33,7 +33,7 @@ export const getStaticPaths: GetStaticPaths<StaticParams> = getExamplesCommonSta
* @see https://github.com/vercel/next.js/discussions/10949#discussioncomment-6884
* @see https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation
*/
export const getStaticProps: GetStaticProps<SSGPageProps, StaticParams> = getExamplesCommonStaticProps;
export const getStaticProps: GetStaticProps<SSGPageProps, CommonServerSideParams> = getExamplesCommonStaticProps;

/**
* SSG pages are first rendered by the server (during static bundling)
Expand Down
Loading

0 comments on commit 59bd4f7

Please sign in to comment.