- Notifications
- Fork 26k
-
Star 121k
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鈥檒l 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
Create types for the configuration in next.config.js (and the NextConfig type) #8044
Comments
timneutkens
commented
Aug 10, 2019
We're currently not planning on allowing |
evgenymarkov
commented
Aug 26, 2019
•
edited
edited
Types can be used via JSDoc, it'll help developers to annotate their
|
zenVentzi
commented
Mar 19, 2020
Any movement on this? |
next.config.js
NextConfig
#10254
tylerbrostrom
commented
Nov 23, 2020
Snowpack鈥檚 official TypeScript templates use Implementing a NextConfig type seems like it might be a pain in the butt, especially if it鈥檚 to be integrated into the codebase (as opposed to a third-party Definitely Typed package). Might be more of a maintenance burden than it鈥檚 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! |
timneutkens
commented
Nov 24, 2020
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. |
balazsorban44
commented
Jan 29, 2022
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: