-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create types for the configuration in next.config.js (and the NextConfig type) #8044
Comments
We're currently not planning on allowing |
Any movement on this? |
Snowpack’s official TypeScript templates use Implementing a NextConfig type seems like it might be a pain in the butt, especially if it’s to be integrated into the codebase (as opposed to a third-party Definitely Typed package). Might be more of a maintenance burden than it’s worth? @timneutkens would you be open to a PR integrating a NextConfig type? I figured you might have a better idea of how feasible/worthwhile this might be 🙂 Thanks! |
Sure there's already multiple PRs to add such a type but they have not been merged yet given they were incomplete/did not have tests. If you open a new PR we'd be happy to take a look. |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Feature request
Is your feature request related to a problem? Please describe.
Since I transpile a
next.config.ts
tonext.config.js
, it would be good to have typings for the configuration object. This is what is currently typed asany
in https://github.com/zeit/next.js/blob/fce7e4eaee45e89557ceaa81fbd42057f8596e22/packages/next-server/server/next-server.ts#L37This is also a problem when using the programmatic API, since the
conf
property on the options given tonext
is typed asany
:Describe the solution you'd like
The previous types provided by
@types/next
and@types/next-server
can be seen here:https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/next-server/next-config.d.ts
Perhaps the easiest solution is to type
NextConfig
with something similar to the version that@types/next-server
is based on:https://github.com/zeit/next.js/blob/7.0.0/server/config.js#L9-L20
Describe alternatives you've considered
The option that I see is to maintain types for the configuration object in parallel to this repository, or simply use the configuration untyped.
The text was updated successfully, but these errors were encountered: