Skip to content

Types of all keys in scripts.registry inferred as any in nuxt.config.ts in Nuxt 4 tsconfig setupΒ #483

@benedictleejh

Description

@benedictleejh

πŸ› The bug

When trying to setup scripts in Nuxt config, all keys inside the registry config key are being inferred as any by TypeScript:

Image

πŸ› οΈ To reproduce

https://stackblitz.com/edit/nuxt-starter-wqfrm3oc?file=nuxt.config.ts

🌈 Expected behavior

The types should be properly inferred as per the type definitions provided by Nuxt Scripts.

ℹ️ Additional context

I can consistently replicate this locally on Windows, Mac, and Linux (WSL OpenSUSE Tumbleweed), but for some reason, the types work on StackBlitz. I have tried switching to pnpm 8 locally to match StackBlitz, but the types are still being inferred as any.

The StackBlitz project, and all my attempted local reproductions were created from the minimal Nuxt starter, with the Nuxt Scripts module added; the Nuxt Scripts starter in StackBlitz refused to provide me with types on hover.

This was seen using Nuxt 4.0.3, TypeScript 5.9.2, pnpm 10.14.0.

I could just be missing some configuration somewhere, but I can't figure out how the StackBlitz and local repos are different.

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