mirror of
https://github.com/d0zingcat/nextjs-notion-starter-kit.git
synced 2026-05-13 23:16:47 +00:00
Merge pull request #330 from bytrangle/getStaticProps-type-checking
feat: add type safety for getStaticProps
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { ExtendedRecordMap, PageMap } from 'notion-types'
|
||||
import { ParsedUrlQuery } from 'querystring'
|
||||
|
||||
export * from 'notion-types'
|
||||
|
||||
@@ -16,6 +17,10 @@ export interface PageProps {
|
||||
error?: PageError
|
||||
}
|
||||
|
||||
export interface Params extends ParsedUrlQuery {
|
||||
pageId: string
|
||||
}
|
||||
|
||||
export interface Site {
|
||||
name: string
|
||||
domain: string
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import * as React from 'react'
|
||||
import { GetStaticProps } from 'next'
|
||||
import { isDev, domain } from 'lib/config'
|
||||
import { getSiteMap } from 'lib/get-site-map'
|
||||
import { resolveNotionPage } from 'lib/resolve-notion-page'
|
||||
import { PageProps, Params } from 'lib/types'
|
||||
import { NotionPage } from 'components'
|
||||
|
||||
export const getStaticProps = async (context) => {
|
||||
export const getStaticProps: GetStaticProps<PageProps, Params> = async (context) => {
|
||||
const rawPageId = context.params.pageId as string
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user