File tree 2 files changed +10
-5
lines changed
2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' nextra-theme-blog ' : patch
3
+ ' nextra-theme-docs ' : patch
4
+ ' nextra ' : patch
5
+ ---
6
+
7
+ remove explicit ` ZodError ` assertion
Original file line number Diff line number Diff line change 2
2
import { createRequire } from 'node:module'
3
3
import { sep } from 'node:path'
4
4
import type { NextConfig } from 'next'
5
- import type { ZodError } from 'zod'
6
5
import { fromZodError } from 'zod-validation-error'
7
6
import type { Nextra } from '../types'
8
7
import {
@@ -25,11 +24,10 @@ const require = createRequire(import.meta.url)
25
24
const AGNOSTIC_PAGE_MAP_PATH = `.next${ sep } static${ sep } chunks${ sep } nextra-page-map`
26
25
27
26
const nextra : Nextra = nextraConfig => {
28
- try {
29
- nextraConfigSchema . parse ( nextraConfig )
30
- } catch ( error ) {
27
+ const { error } = nextraConfigSchema . safeParse ( nextraConfig )
28
+ if ( error ) {
31
29
logger . error ( 'Error validating nextraConfig' )
32
- throw fromZodError ( error as ZodError )
30
+ throw fromZodError ( error )
33
31
}
34
32
35
33
return function withNextra ( nextConfig = { } ) {
You can’t perform that action at this time.
0 commit comments