Unverified Commit 4e9cc189 authored by Ben Gubler's avatar Ben Gubler Committed by GitHub

fix: don't fail with amp config in JS (#82798)

Because tsc doesn't infer string literal types in JS files

---------
Co-authored-by: 's avatarJJ Kasper <jj@jjsweb.site>
parent c57fe256
...@@ -475,7 +475,7 @@ export function generateValidatorFile( ...@@ -475,7 +475,7 @@ export function generateValidatorFile(
* Validated at build-time by parsePagesSegmentConfig. * Validated at build-time by parsePagesSegmentConfig.
*/ */
config?: { config?: {
amp?: boolean | 'hybrid' amp?: boolean | 'hybrid' | string // necessary for JS
maxDuration?: number maxDuration?: number
runtime?: 'edge' | 'experimental-edge' | 'nodejs' | string // necessary unless config is exported as const runtime?: 'edge' | 'experimental-edge' | 'nodejs' | string // necessary unless config is exported as const
regions?: string[] regions?: string[]
......
import { useAmp } from 'next/amp'
export const config = { amp: 'hybrid' }
export default () => {
const isAmp = useAmp()
return `Hello ${isAmp ? 'AMP' : 'others'}`
}
import { NextApiRequest, NextApiResponse } from 'next'
export const config = {
api: {
bodyParser: {
sizeLimit: '5mb',
},
},
}
export default (req: NextApiRequest, res: NextApiResponse) => {
res.status(200).json(req.body)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment