[docs-infra] Add types for withDocsInfra #40301
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This catches issues like in mui/toolpad#3026, proof:
It seems that we won't see a next.config.ts support anytime soon: vercel/next.js#5318. But why not lint the file anyway. The alternative would be to have a runtime check of the params like done by Next.js in vercel/next.js#58247 but I don't know, TypeScript feels meant for this purpose.
Assuming that all current & future projects that use docs-infra have to link the config file, it should be OK. We are not playing this card https://github.com/facebook/docusaurus yet.
Now, to be fair, I like how zod also allows us to flag outdated params, ones that do nothing https://github.com/vercel/next.js/blob/0fc1d9e982c9fe2a8da23d95943cd161de4c3178/packages/next/src/server/config.ts#L1004.