Skip to content
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

type images?: ImageOption on next.config.js does not allow optional properties. #28708

Closed
catnose99 opened this issue Sep 1, 2021 · 2 comments · Fixed by #28709
Closed

type images?: ImageOption on next.config.js does not allow optional properties. #28708

catnose99 opened this issue Sep 1, 2021 · 2 comments · Fixed by #28709

Comments

@catnose99
Copy link
Contributor

catnose99 commented Sep 1, 2021

What version of Next.js are you using?

v11.1.2

What version of Node.js are you using?

v15.8.0

What browser are you using?

Chrome

What operating system are you using?

macOS

How are you deploying your application?

Vercel

Describe the Bug

On next.config.js, setting single property to images option cause a TypeError.

Type '{ disableStaticImages: true; }' is missing the following properties
from type 'ImageConfig': deviceSizes, imageSizes, loader, path

スクリーンショット 2021-09-01 23 05 23

This happens because deviceSizes, imageSizes, loader and path are required in ImageConfig.

// https://github.com/vercel/next.js/blob/8151a7e0dc9a029a9c4261901d333f67d23f718f/packages/next/server/image-config.ts
type ImageConfig = {
    deviceSizes: number[];
    imageSizes: number[];
    loader: LoaderValue;
    path: string;
    domains?: string[];
    disableStaticImages?: boolean;
    minimumCacheTTL?: number;
};

Expected Behavior

Should allow single property as written in document

module.exports = {
  images: {
    disableStaticImages: true,
  },
}

To Reproduce

Paste below code into your next.config.js

// @ts-check

/**
 * @type {import('next').NextConfig}
 */
const nextConfig = {
  images: {
    disableStaticImages: true,
  },
};

module.exports = nextConfig;
@catnose99 catnose99 added the bug Issue was opened via the bug report template. label Sep 1, 2021
@catnose99
Copy link
Contributor Author

Created a pull request.

@styfle styfle added kind: bug and removed bug Issue was opened via the bug report template. labels Sep 3, 2021
@kodiakhq kodiakhq bot closed this as completed in #28709 Sep 8, 2021
kodiakhq bot pushed a commit that referenced this issue Sep 8, 2021
## Bug
- Fixes #28708

- [x] Related issues linked using `fixes #number`
@balazsorban44
Copy link
Member

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.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants