Skip to content

Type Error: Component 'ui' prop incorrectly typed as 'string', should allow ClassValue (e.g., string[]) #3860

@Ocyss

Description

@Ocyss

Environment

in codesandbox

  • Operating System: Linux
  • Node Version: v20.12.0
  • Nuxt Version: 3.16.1
  • CLI Version: 3.24.0
  • Nitro Version: 2.11.8
  • Package Manager: [email protected]
  • Builder: -
  • User Config: modules, devtools, compatibilityDate, future, css
  • Runtime Modules: @nuxt/[email protected]
  • Build Modules: -

Is this bug related to Nuxt or Vue?

Nuxt

Version

3.16.1

Reproduction

https://codesandbox.io/p/devbox/condescending-bouman-f7zx5z?workspaceId=ws_H6Jd4FNHPBp8UPT5Y6QHKZ

Description

The ui prop on Nuxt UI components (like UTable) is currently typed to only accept string values for its nested properties. However, the official documentation example for expandable table rows (https://ui.nuxt.com/components/table#with-expandable-rows) demonstrates using a string[] for customizing the button ui.leadingIcon property.

While using a string[] works correctly at runtime, it triggers a TypeScript error during development:

Image

The relevant type definition should be updated:

export type PartialString<T> = {
    [K in keyof T]?: string;
};

Proposed Change:

import type { ClassValue } from 'tailwind-variants';

export type PartialString<T> = {
    [K in keyof T]?: ClassValue;
};

Additional context

No response

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingv3#1289

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions