Skip to content

Commit

Permalink
Merge pull request #948 from tszhong0411/app-32-fix-searchparams-type
Browse files Browse the repository at this point in the history
Fix searchParams type
  • Loading branch information
tszhong0411 authored Jan 10, 2025
2 parents 4b62937 + bd9a5a8 commit 3955510
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 14 deletions.
10 changes: 6 additions & 4 deletions apps/docs/src/app/(embed)/embed/page.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { getErrorMessage } from '@tszhong0411/utils'

type PageProps = {
params: Promise<Record<string, never>>
searchParams: Promise<{
component: string
}>
params: Promise<Record<string, string | string[] | undefined>>
searchParams: Promise<Record<string, string | string[] | undefined>>
}

const Page = async (props: PageProps) => {
const { component } = await props.searchParams

if (!component || typeof component !== 'string') {
return <div>Error: Invalid component name</div>
}

try {
const Component = (await import(`@/components/demos/${component}`)).default

Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/[locale]/(admin)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type LayoutProps = {
params: Promise<{
locale: string
}>
searchParams: Promise<Record<string, never>>
searchParams: Promise<Record<string, string | string[] | undefined>>
children: React.ReactNode
}

Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/[locale]/(main)/about/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type PageProps = {
params: Promise<{
locale: string
}>
searchParams: Promise<Record<string, never>>
searchParams: Promise<Record<string, string | string[] | undefined>>
}

export const generateStaticParams = (): Array<{ locale: string }> => {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/[locale]/(main)/blog/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type PageProps = {
slug: string
locale: string
}>
searchParams: Promise<Record<string, never>>
searchParams: Promise<Record<string, string | string[] | undefined>>
}

export const generateStaticParams = (): Array<{ slug: string; locale: string }> => {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/[locale]/(main)/blog/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type PageProps = {
params: Promise<{
locale: string
}>
searchParams: Promise<Record<string, never>>
searchParams: Promise<Record<string, string | string[] | undefined>>
}

export const generateStaticParams = (): Array<{ locale: string }> => {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/[locale]/(main)/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type PageProps = {
params: Promise<{
locale: string
}>
searchParams: Promise<Record<string, never>>
searchParams: Promise<Record<string, string | string[] | undefined>>
}

export const generateStaticParams = (): Array<{ locale: string }> => {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/[locale]/(main)/guestbook/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type PageProps = {
params: Promise<{
locale: string
}>
searchParams: Promise<Record<string, never>>
searchParams: Promise<Record<string, string | string[] | undefined>>
}

export const generateStaticParams = (): Array<{ locale: string }> => {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/[locale]/(main)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type PageProps = {
params: Promise<{
locale: string
}>
searchParams: Promise<Record<string, never>>
searchParams: Promise<Record<string, string | string[] | undefined>>
}

export const generateStaticParams = (): Array<{ locale: string }> => {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/[locale]/(main)/projects/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type PageProps = {
slug: string
locale: string
}>
searchParams: Promise<Record<string, never>>
searchParams: Promise<Record<string, string | string[] | undefined>>
}

export const generateStaticParams = (): Array<{ slug: string; locale: string }> => {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/[locale]/(main)/projects/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type PageProps = {
params: Promise<{
locale: string
}>
searchParams: Promise<Record<string, never>>
searchParams: Promise<Record<string, string | string[] | undefined>>
}

export const generateStaticParams = (): Array<{ locale: string }> => {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/[locale]/(main)/uses/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type PageProps = {
params: Promise<{
locale: string
}>
searchParams: Promise<Record<string, never>>
searchParams: Promise<Record<string, string | string[] | undefined>>
}

export const generateStaticParams = (): Array<{ locale: string }> => {
Expand Down

0 comments on commit 3955510

Please sign in to comment.