I would use fallback: 'blocking', for my Next.js page, but TypeScript refuses it. Has the latest 12.2.0 Next.js. What is wrong?
Type '() => Promise<{ paths: any; fallback: string; }>' is not assignable to type 'GetStaticPaths<ParsedUrlQuery>'.
Type 'Promise<{ paths: any; fallback: string; }>' is not assignable to type 'GetStaticPathsResult<ParsedUrlQuery> | Promise<GetStaticPathsResult<ParsedUrlQuery>>'.
Type 'Promise<{ paths: any; fallback: string; }>' is not assignable to type 'Promise<GetStaticPathsResult<ParsedUrlQuery>>'.
Type '{ paths: any; fallback: string; }' is not assignable to type 'GetStaticPathsResult<ParsedUrlQuery>'.
Types of property 'fallback' are incompatible.
Type 'string' is not assignable to type 'boolean | "blocking"'.
and the code:
export const getStaticPaths: GetStaticPaths = async () => {
// ...
const paths = res.data.map((organizationAndPostId: string) => ({
params: {
organizationShortId: organizationAndPostId[0],
postId: organizationAndPostId[1],
tempUserShortId: organizationAndPostId[2],
imgId: organizationAndPostId[3],
},
}))
let ret = {
paths,
fallback: 'blocking',
}
return ret
}
I think problem is with " or '. But VSCode automatically converts it to '.