Skip to content

Type-error inside scripts.registry: string is not assignable to never #700

Description

@TotomInc

🐛 The bug

Given this Nuxt config:

  $production: {
    scripts: {
      registry: {
        // Enable Matomo Analytics only for production build.
        // See: https://scripts.nuxt.com/scripts/analytics/matomo-analytics
        // Source-code: https://github.com/nuxt/scripts/blob/main/src/runtime/registry/matomo-analytics.ts
        matomoAnalytics: {
          matomoUrl: "https://numberly.matomo.cloud",
          siteId: 1,
          // Disable cookie tracking.
          // See: https://matomo.org/faq/general/faq_157/
          // List of cookies: https://matomo.org/faq/general/faq_146/
          disableCookies: true,
          // Enable automatic page view tracking.
          watch: true,
        },
      },
    },
  },

All properties inside matomoAnalytics doesn't work anymore.
For each property, I have the following TS error:

Type 'string' is not assignable to type 'never'.

I believe the type is invalid and broken somewhere:

matomoAnalytics?: NuxtConfigScriptRegistryEntry<any> | undefined
Image

It worked fine in 1.0.0-beta.32. I got the error while trying to update to 1.0.0-rc.6.

🛠️ To reproduce

https://stackblitz.com/edit/nuxt-scripts-repro-700

However, stackblitz doesn't have working types so you'll get another error. Best is to copy/paste the nuxt.config.ts scripts section into a clean Nuxt project.

🌈 Expected behavior

Types of the module for each registry item should resolve correctly, whether it's inside a $production or at the root level of the nuxt.config.ts config file.

ℹ️ Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions