question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[request] better typescript type for `next.config.js` NextConfig

See original GitHub issue

Feature request

Is your feature request related to a problem? Please describe.

i only see this, but any not a good type

declare type NextConfig = any;

if have a type/interface for this we can more easy write a next.config or a config plugin

Describe the solution you’d like

A clear and concise description of what you want to happen.

Describe alternatives you’ve considered

A clear and concise description of any alternative solutions or features you’ve considered.

Additional context

Add any other context or screenshots about the feature request here.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:17
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

7reactions
eps1loncommented, Apr 12, 2020

Just leaving my use case here after #8044 was closed without much considerations:

Is your feature request related to a problem? Please describe.

Documentation for config is incomplete and spread out. In-editor autocomplete solves this via types.

Describe the solution you’d like

Export types of next.config.js so that people can use JSDOC to get autcomplete for the config via

/**
 * @type {import('next').Config}
 */
const config = {
  // your config here
};
module.exports = config;

Describe alternatives you’ve considered

Declare the types locally starting from https://github.com/zeit/next.js/blob/287961ed9142a53f8e9a23bafb2f31257339ea98/packages/next/next-server/server/config.ts#L12-L65

1reaction
lfadescommented, Sep 28, 2020

This is not one of our current priorities but I’m open to review a PR that adds types for Next.js configurations (similar to #13429 which was closed due to being quite outdated)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Basic Features: TypeScript - Next.js
Next.js provides an integrated TypeScript experience, including zero-configuration set up and built-in types for Pages, APIs, and more.
Read more >
Next.js + TypeScript: Tips and FAQs for Every Stage of Your ...
Types enable better introspection, which catches bugs before they have a chance to run in the application. Code editors are able to provide...
Read more >
Next.js-config with type checking - flaming.codes
Next.js doesn't support Typescript-types for its config yet, but you can still include some utility typings.
Read more >
Why does my jest setup not work with top-level await
My next.config.js to support top-level await via Webpack: /** @type {import('next').NextConfig} */ const nextConfig = { reactStrictMode: ...
Read more >
Next.js - Tauri Apps
We want to customize this file to get the best compatibility with Tauri. Update the file with the following content: next.config.js. /** @type...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found