Skip to content

defineProps does not accept types created by TypeScripts' Pick type after installing Nuxt UI 4Β #4959

@vitpetricak

Description

@vitpetricak

Environment

  • Operating System: Linux
  • Node Version: v22.17.0
  • Nuxt Version: 4.1.1
  • CLI Version: 3.28.0
  • Nitro Version: 2.12.6
  • Package Manager: [email protected]
  • Builder: -
  • User Config: compatibilityDate, devtools, modules, css, vite
  • Runtime Modules: @nuxt/[email protected]
  • Build Modules: -

Is this bug related to Nuxt or Vue?

Nuxt

Package

v4.0.0-alpha.x

Version

v4.0.0-alpha.1

Reproduction

https://github.com/vitpetricak/nuxt-defineProps-repro

Description

After adding Nuxt UI 4 to existing project, I was not able to use TypeScripts type Pick to define props of components. The server would crash with 55 and message:

Error: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference. (6:14)

Without Nuxt UI, this works without any issues:

defineProps<Pick<FooType, "foo" | "bar">>();

I have tried recent type-focused PR #4954, but the problem remains.

Additional context

No response

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageAwaiting initial review and prioritizationv4#4488

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions