nuxt-modules / color-mode

Dark and Light mode with auto detection made easy with Nuxt 🌗
https://color-mode.nuxtjs.org
MIT License
1.07k stars 98 forks source link

TS complains "Object literal may only specify known properties, and 'colorMode' does not exist in type 'InputConfig<NuxtConfig, ConfigLayerMeta>'." #273

Open rowild opened 1 month ago

rowild commented 1 month ago

Version

@nuxtjs/color-mode: 3.4.2 nuxt: 3.12.3

Steps to reproduce

  1. Setup a new Nuxt project with npx nuxi@latest init <project-name>
  2. cd
  3. npm i
  4. npm i -D @nuxtjs/color-mode
  5. Add to export default defineNuxtConfig({

colorMode: { preference: 'system', // default value of $colorMode.preference fallback: 'light', // fallback value if not system preference found hid: 'nuxt-color-mode-script', globalName: '__NUXT_COLOR_MODE__', componentName: 'ColorScheme', classPrefix: '', classSuffix: '-mode', storageKey: 'nuxt-color-mode' },

What is Expected?

No errors

What is actually happening?

TypeScript complains and errors are popping up as can be seen in the screenshot

Screenshot 2024-07-04 at 17 49 05

reiyanyan commented 1 month ago

just run "npm run postinstall" to re-generate types in .nuxt/